From 86f34f8216ae0c9980849bc7e5e2b359fea45f23 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Fri, 19 Jan 2024 20:05:56 +0100 Subject: [PATCH] Add icon translations to Anova (#108399) --- homeassistant/components/anova/icons.json | 24 +++++++++++++++++++++++ homeassistant/components/anova/sensor.py | 14 ++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 homeassistant/components/anova/icons.json diff --git a/homeassistant/components/anova/icons.json b/homeassistant/components/anova/icons.json new file mode 100644 index 00000000000..9e0e88178d3 --- /dev/null +++ b/homeassistant/components/anova/icons.json @@ -0,0 +1,24 @@ +{ + "entity": { + "sensor": { + "cook_time": { + "default": "mdi:clock-outline" + }, + "target_temperature": { + "default": "mdi:thermometer" + }, + "cook_time_remaining": { + "default": "mdi:clock-outline" + }, + "heater_temperature": { + "default": "mdi:thermometer" + }, + "triac_temperature": { + "default": "mdi:thermometer" + }, + "water_temperature": { + "default": "mdi:thermometer" + } + } + } +} diff --git a/homeassistant/components/anova/sensor.py b/homeassistant/components/anova/sensor.py index b7657e26249..24bda4dbed6 100644 --- a/homeassistant/components/anova/sensor.py +++ b/homeassistant/components/anova/sensor.py @@ -42,30 +42,31 @@ SENSOR_DESCRIPTIONS: list[SensorEntityDescription] = [ key="cook_time", state_class=SensorStateClass.TOTAL_INCREASING, native_unit_of_measurement=UnitOfTime.SECONDS, - icon="mdi:clock-outline", translation_key="cook_time", device_class=SensorDeviceClass.DURATION, value_fn=lambda data: data.cook_time, ), AnovaSensorEntityDescription( - key="state", translation_key="state", value_fn=lambda data: data.state + key="state", + translation_key="state", + value_fn=lambda data: data.state, ), AnovaSensorEntityDescription( - key="mode", translation_key="mode", value_fn=lambda data: data.mode + key="mode", + translation_key="mode", + value_fn=lambda data: data.mode, ), AnovaSensorEntityDescription( key="target_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - icon="mdi:thermometer", translation_key="target_temperature", value_fn=lambda data: data.target_temperature, ), AnovaSensorEntityDescription( key="cook_time_remaining", native_unit_of_measurement=UnitOfTime.SECONDS, - icon="mdi:clock-outline", translation_key="cook_time_remaining", device_class=SensorDeviceClass.DURATION, value_fn=lambda data: data.cook_time_remaining, @@ -75,7 +76,6 @@ SENSOR_DESCRIPTIONS: list[SensorEntityDescription] = [ native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - icon="mdi:thermometer", translation_key="heater_temperature", value_fn=lambda data: data.heater_temperature, ), @@ -84,7 +84,6 @@ SENSOR_DESCRIPTIONS: list[SensorEntityDescription] = [ native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - icon="mdi:thermometer", translation_key="triac_temperature", value_fn=lambda data: data.triac_temperature, ), @@ -93,7 +92,6 @@ SENSOR_DESCRIPTIONS: list[SensorEntityDescription] = [ native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - icon="mdi:thermometer", translation_key="water_temperature", value_fn=lambda data: data.water_temperature, ),