mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add state class to screenlogic sensors (#64941)
This commit is contained in:
parent
cb571d86be
commit
87d1478ca4
@ -6,7 +6,11 @@ from screenlogicpy.const import (
|
|||||||
EQUIPMENT,
|
EQUIPMENT,
|
||||||
)
|
)
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
from homeassistant.components.sensor import (
|
||||||
|
SensorDeviceClass,
|
||||||
|
SensorEntity,
|
||||||
|
SensorStateClass,
|
||||||
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -122,6 +126,13 @@ class ScreenLogicSensor(ScreenlogicEntity, SensorEntity):
|
|||||||
device_type = self.sensor.get("device_type")
|
device_type = self.sensor.get("device_type")
|
||||||
return SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS.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
|
@property
|
||||||
def native_value(self):
|
def native_value(self):
|
||||||
"""State of the sensor."""
|
"""State of the sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user