From d9f6e4be242c3449a1be464ac7c07f5ab68cef65 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Sun, 10 Mar 2024 21:55:31 +0100 Subject: [PATCH] Add icon translations to Husqvarna automower (#111727) * Add icon translations to Husqvarna automower * fix --- .../components/husqvarna_automower/icons.json | 12 ++++++++++++ .../components/husqvarna_automower/sensor.py | 2 -- .../husqvarna_automower/snapshots/test_sensor.ambr | 6 ++---- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 homeassistant/components/husqvarna_automower/icons.json diff --git a/homeassistant/components/husqvarna_automower/icons.json b/homeassistant/components/husqvarna_automower/icons.json new file mode 100644 index 00000000000..a0dd316b535 --- /dev/null +++ b/homeassistant/components/husqvarna_automower/icons.json @@ -0,0 +1,12 @@ +{ + "entity": { + "sensor": { + "number_of_charging_cycles": { + "default": "mdi:battery-sync-outline" + }, + "number_of_collisions": { + "default": "mdi:counter" + } + } + } +} diff --git a/homeassistant/components/husqvarna_automower/sensor.py b/homeassistant/components/husqvarna_automower/sensor.py index 5358ad6e4cf..40f676df541 100644 --- a/homeassistant/components/husqvarna_automower/sensor.py +++ b/homeassistant/components/husqvarna_automower/sensor.py @@ -105,7 +105,6 @@ SENSOR_TYPES: tuple[AutomowerSensorEntityDescription, ...] = ( AutomowerSensorEntityDescription( key="number_of_charging_cycles", translation_key="number_of_charging_cycles", - icon="mdi:battery-sync-outline", entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.TOTAL, value_fn=lambda data: data.statistics.number_of_charging_cycles, @@ -113,7 +112,6 @@ SENSOR_TYPES: tuple[AutomowerSensorEntityDescription, ...] = ( AutomowerSensorEntityDescription( key="number_of_collisions", translation_key="number_of_collisions", - icon="mdi:counter", entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.TOTAL, value_fn=lambda data: data.statistics.number_of_collisions, diff --git a/tests/components/husqvarna_automower/snapshots/test_sensor.ambr b/tests/components/husqvarna_automower/snapshots/test_sensor.ambr index f03624627bf..2e6dfcc52f0 100644 --- a/tests/components/husqvarna_automower/snapshots/test_sensor.ambr +++ b/tests/components/husqvarna_automower/snapshots/test_sensor.ambr @@ -234,7 +234,7 @@ 'options': dict({ }), 'original_device_class': None, - 'original_icon': 'mdi:battery-sync-outline', + 'original_icon': None, 'original_name': 'Number of charging cycles', 'platform': 'husqvarna_automower', 'previous_unique_id': None, @@ -248,7 +248,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'Test Mower 1 Number of charging cycles', - 'icon': 'mdi:battery-sync-outline', 'state_class': , }), 'context': , @@ -283,7 +282,7 @@ 'options': dict({ }), 'original_device_class': None, - 'original_icon': 'mdi:counter', + 'original_icon': None, 'original_name': 'Number of collisions', 'platform': 'husqvarna_automower', 'previous_unique_id': None, @@ -297,7 +296,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'Test Mower 1 Number of collisions', - 'icon': 'mdi:counter', 'state_class': , }), 'context': ,