From 9cf874d4a07184ec6c54369ba1be9c17135f0b5a Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 27 Feb 2024 23:41:07 +0100 Subject: [PATCH] Add icon translations to Energyzero (#111513) * Add icon translations to Energyzero * Add icon translations to Energyzero --- homeassistant/components/energyzero/icons.json | 16 ++++++++++++++++ homeassistant/components/energyzero/sensor.py | 2 -- .../energyzero/snapshots/test_sensor.ambr | 3 +-- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 homeassistant/components/energyzero/icons.json diff --git a/homeassistant/components/energyzero/icons.json b/homeassistant/components/energyzero/icons.json new file mode 100644 index 00000000000..bac061dd318 --- /dev/null +++ b/homeassistant/components/energyzero/icons.json @@ -0,0 +1,16 @@ +{ + "entity": { + "sensor": { + "percentage_of_max": { + "default": "mdi:percent" + }, + "hours_priced_equal_or_lower": { + "default": "mdi:clock" + } + } + }, + "services": { + "get_gas_prices": "mdi:gas-station", + "get_energy_prices": "mdi:lightning-bolt" + } +} diff --git a/homeassistant/components/energyzero/sensor.py b/homeassistant/components/energyzero/sensor.py index 50cc2f21bd3..005abb62e91 100644 --- a/homeassistant/components/energyzero/sensor.py +++ b/homeassistant/components/energyzero/sensor.py @@ -117,7 +117,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( translation_key="percentage_of_max", service_type="today_energy", native_unit_of_measurement=PERCENTAGE, - icon="mdi:percent", value_fn=lambda data: data.energy_today.pct_of_max_price, ), EnergyZeroSensorEntityDescription( @@ -125,7 +124,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( translation_key="hours_priced_equal_or_lower", service_type="today_energy", native_unit_of_measurement=UnitOfTime.HOURS, - icon="mdi:clock", value_fn=lambda data: data.energy_today.hours_priced_equal_or_lower, ), ) diff --git a/tests/components/energyzero/snapshots/test_sensor.ambr b/tests/components/energyzero/snapshots/test_sensor.ambr index badbda7360b..84a027b89f1 100644 --- a/tests/components/energyzero/snapshots/test_sensor.ambr +++ b/tests/components/energyzero/snapshots/test_sensor.ambr @@ -674,7 +674,6 @@ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by EnergyZero', 'friendly_name': 'Energy market price Hours priced equal or lower than current - today', - 'icon': 'mdi:clock', 'unit_of_measurement': , }), 'context': , @@ -707,7 +706,7 @@ 'options': dict({ }), 'original_device_class': None, - 'original_icon': 'mdi:clock', + 'original_icon': None, 'original_name': 'Hours priced equal or lower than current - today', 'platform': 'energyzero', 'previous_unique_id': None,