From e410977e6400d954dd80e8a508c02dd8a72ee944 Mon Sep 17 00:00:00 2001 From: "Lektri.co" <137074859+Lektrico@users.noreply.github.com> Date: Thu, 22 May 2025 11:34:14 +0300 Subject: [PATCH] Add new button to the Lektrico integration (#145420) --- homeassistant/components/lektrico/button.py | 6 +++ .../components/lektrico/strings.json | 3 ++ .../lektrico/snapshots/test_button.ambr | 47 +++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/homeassistant/components/lektrico/button.py b/homeassistant/components/lektrico/button.py index e598773321d..95913b33700 100644 --- a/homeassistant/components/lektrico/button.py +++ b/homeassistant/components/lektrico/button.py @@ -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, diff --git a/homeassistant/components/lektrico/strings.json b/homeassistant/components/lektrico/strings.json index 23aac0b3059..6664dd9672d 100644 --- a/homeassistant/components/lektrico/strings.json +++ b/homeassistant/components/lektrico/strings.json @@ -60,6 +60,9 @@ }, "charge_stop": { "name": "Charge stop" + }, + "charging_schedule_override": { + "name": "Charging schedule override" } }, "number": { diff --git a/tests/components/lektrico/snapshots/test_button.ambr b/tests/components/lektrico/snapshots/test_button.ambr index f9cb7189237..760a2f9fcdd 100644 --- a/tests/components/lektrico/snapshots/test_button.ambr +++ b/tests/components/lektrico/snapshots/test_button.ambr @@ -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': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'button', + 'entity_category': , + 'entity_id': 'button.1p7k_500006_charging_schedule_override', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + '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': , + 'entity_id': 'button.1p7k_500006_charging_schedule_override', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- # name: test_all_entities[button.1p7k_500006_restart-entry] EntityRegistryEntrySnapshot({ 'aliases': set({