From d8cb7c475b4b0fb5591702b04feb8c4d28634c24 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Sat, 26 Apr 2025 17:22:44 +0300 Subject: [PATCH] Update Switcher temperature sensor device class and state class (#143722) * Update Switcher temperature sensor device class and state class * Remove temperature translation key * Remove icon --- homeassistant/components/switcher_kis/icons.json | 3 --- homeassistant/components/switcher_kis/sensor.py | 6 ++++-- homeassistant/components/switcher_kis/strings.json | 3 --- tests/components/switcher_kis/test_sensor.py | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/switcher_kis/icons.json b/homeassistant/components/switcher_kis/icons.json index bd770d3e656..6ca8e0e8351 100644 --- a/homeassistant/components/switcher_kis/icons.json +++ b/homeassistant/components/switcher_kis/icons.json @@ -20,9 +20,6 @@ }, "auto_shutdown": { "default": "mdi:progress-clock" - }, - "temperature": { - "default": "mdi:thermometer" } } }, diff --git a/homeassistant/components/switcher_kis/sensor.py b/homeassistant/components/switcher_kis/sensor.py index 5676fb250de..e918b8eb4c1 100644 --- a/homeassistant/components/switcher_kis/sensor.py +++ b/homeassistant/components/switcher_kis/sensor.py @@ -21,7 +21,7 @@ from homeassistant.components.sensor import ( SensorStateClass, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import UnitOfElectricCurrent, UnitOfPower +from homeassistant.const import UnitOfElectricCurrent, UnitOfPower, UnitOfTemperature from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -71,7 +71,9 @@ TIME_SENSORS: list[SwitcherSensorEntityDescription] = [ TEMPERATURE_SENSORS: list[SwitcherSensorEntityDescription] = [ SwitcherSensorEntityDescription( key="temperature", - translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, value_fn=lambda data: cast(SwitcherThermostatBase, data).temperature, ), ] diff --git a/homeassistant/components/switcher_kis/strings.json b/homeassistant/components/switcher_kis/strings.json index 72f5e11161d..5eece295aa8 100644 --- a/homeassistant/components/switcher_kis/strings.json +++ b/homeassistant/components/switcher_kis/strings.json @@ -67,9 +67,6 @@ }, "auto_shutdown": { "name": "Auto shutdown" - }, - "temperature": { - "name": "Current temperature" } }, "switch": { diff --git a/tests/components/switcher_kis/test_sensor.py b/tests/components/switcher_kis/test_sensor.py index aedc004859f..1a6c2ccb687 100644 --- a/tests/components/switcher_kis/test_sensor.py +++ b/tests/components/switcher_kis/test_sensor.py @@ -32,7 +32,7 @@ DEVICE_SENSORS_TUPLE = ( ( DUMMY_THERMOSTAT_DEVICE, [ - ("current_temperature", "temperature"), + ("temperature", "temperature"), ], ), )