From f7c43710dc844eff529a2d1cda6a08e00f600f6e Mon Sep 17 00:00:00 2001 From: Jonas Fors Lellky Date: Tue, 13 Feb 2024 16:09:18 +0100 Subject: [PATCH] Refactor flexit_bacnet to use icon translations (#110479) --- homeassistant/components/flexit_bacnet/icons.json | 8 ++++++++ homeassistant/components/flexit_bacnet/switch.py | 1 - tests/components/flexit_bacnet/snapshots/test_switch.ambr | 4 +--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/flexit_bacnet/icons.json b/homeassistant/components/flexit_bacnet/icons.json index 0e1305082ce..7ce8b116a27 100644 --- a/homeassistant/components/flexit_bacnet/icons.json +++ b/homeassistant/components/flexit_bacnet/icons.json @@ -31,6 +31,14 @@ "home_supply_fan_setpoint": { "default": "mdi:fan-plus" } + }, + "switch": { + "electric_heater": { + "default": "mdi:radiator", + "state": { + "off": "mdi:radiator-off" + } + } } } } diff --git a/homeassistant/components/flexit_bacnet/switch.py b/homeassistant/components/flexit_bacnet/switch.py index b3751c90f7d..0a7785eaa38 100644 --- a/homeassistant/components/flexit_bacnet/switch.py +++ b/homeassistant/components/flexit_bacnet/switch.py @@ -35,7 +35,6 @@ SWITCHES: tuple[FlexitSwitchEntityDescription, ...] = ( FlexitSwitchEntityDescription( key="electric_heater", translation_key="electric_heater", - icon="mdi:radiator", is_on_fn=lambda data: data.electric_heater, turn_on_fn=lambda data: data.enable_electric_heater(), turn_off_fn=lambda data: data.disable_electric_heater(), diff --git a/tests/components/flexit_bacnet/snapshots/test_switch.ambr b/tests/components/flexit_bacnet/snapshots/test_switch.ambr index 4db770917b0..73f069c8e26 100644 --- a/tests/components/flexit_bacnet/snapshots/test_switch.ambr +++ b/tests/components/flexit_bacnet/snapshots/test_switch.ambr @@ -20,7 +20,7 @@ 'options': dict({ }), 'original_device_class': , - 'original_icon': 'mdi:radiator', + 'original_icon': None, 'original_name': 'Electric heater', 'platform': 'flexit_bacnet', 'previous_unique_id': None, @@ -35,7 +35,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'switch', 'friendly_name': 'Device Name Electric heater', - 'icon': 'mdi:radiator', }), 'context': , 'entity_id': 'switch.device_name_electric_heater', @@ -49,7 +48,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'switch', 'friendly_name': 'Device Name Electric heater', - 'icon': 'mdi:radiator', }), 'context': , 'entity_id': 'switch.device_name_electric_heater',