Add new button to the Lektrico integration (#145420)

This commit is contained in:
Lektri.co 2025-05-22 11:34:14 +03:00 committed by GitHub
parent d48ca1d858
commit e410977e64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 56 additions and 0 deletions

View File

@ -39,6 +39,12 @@ BUTTONS_FOR_CHARGERS: tuple[LektricoButtonEntityDescription, ...] = (
entity_category=EntityCategory.CONFIG,
press_fn=lambda device: device.send_charge_stop(),
),
LektricoButtonEntityDescription(
key="charging_schedule_override",
translation_key="charging_schedule_override",
entity_category=EntityCategory.CONFIG,
press_fn=lambda device: device.send_charge_schedule_override(),
),
LektricoButtonEntityDescription(
key="reboot",
device_class=ButtonDeviceClass.RESTART,

View File

@ -60,6 +60,9 @@
},
"charge_stop": {
"name": "Charge stop"
},
"charging_schedule_override": {
"name": "Charging schedule override"
}
},
"number": {

View File

@ -93,6 +93,53 @@
'state': 'unknown',
})
# ---
# name: test_all_entities[button.1p7k_500006_charging_schedule_override-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.1p7k_500006_charging_schedule_override',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Charging schedule override',
'platform': 'lektrico',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'charging_schedule_override',
'unique_id': '500006-charging_schedule_override',
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[button.1p7k_500006_charging_schedule_override-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': '1p7k_500006 Charging schedule override',
}),
'context': <ANY>,
'entity_id': 'button.1p7k_500006_charging_schedule_override',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_all_entities[button.1p7k_500006_restart-entry]
EntityRegistryEntrySnapshot({
'aliases': set({