From 87d1478ca46862d010e7e96452292b71f6c5a118 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 25 Jan 2022 18:35:44 -1000 Subject: [PATCH] Add state class to screenlogic sensors (#64941) --- homeassistant/components/screenlogic/sensor.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/screenlogic/sensor.py b/homeassistant/components/screenlogic/sensor.py index e2234586625..7b3c9b0c1f8 100644 --- a/homeassistant/components/screenlogic/sensor.py +++ b/homeassistant/components/screenlogic/sensor.py @@ -6,7 +6,11 @@ from screenlogicpy.const import ( EQUIPMENT, ) -from homeassistant.components.sensor import SensorDeviceClass, SensorEntity +from homeassistant.components.sensor import ( + SensorDeviceClass, + SensorEntity, + SensorStateClass, +) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -122,6 +126,13 @@ class ScreenLogicSensor(ScreenlogicEntity, SensorEntity): device_type = self.sensor.get("device_type") return SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS.get(device_type) + @property + def state_class(self): + """Return the state class of the sensor.""" + if self._data_key == "scg_super_chlor_timer": + return None + return SensorStateClass.MEASUREMENT + @property def native_value(self): """State of the sensor."""