mirror of
https://github.com/home-assistant/core
synced 2024-09-09 12:51:22 +02:00
Add long-term statistics for Tado sensors (#58111)
This commit is contained in:
parent
c0934ce03c
commit
f740302287
@ -1,7 +1,7 @@
|
||||
"""Support for Tado sensors for each zone."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
@ -153,6 +153,13 @@ class TadoHomeSensor(TadoHomeEntity, SensorEntity):
|
||||
return DEVICE_CLASS_TEMPERATURE
|
||||
return None
|
||||
|
||||
@property
|
||||
def state_class(self):
|
||||
"""Return the state class."""
|
||||
if self.home_variable in ["outdoor temperature", "solar percentage"]:
|
||||
return STATE_CLASS_MEASUREMENT
|
||||
return None
|
||||
|
||||
@callback
|
||||
def _async_update_callback(self):
|
||||
"""Update and write state."""
|
||||
@ -259,6 +266,13 @@ class TadoZoneSensor(TadoZoneEntity, SensorEntity):
|
||||
return DEVICE_CLASS_TEMPERATURE
|
||||
return None
|
||||
|
||||
@property
|
||||
def state_class(self):
|
||||
"""Return the state class."""
|
||||
if self.zone_variable in ["ac", "heating", "humidity", "temperature"]:
|
||||
return STATE_CLASS_MEASUREMENT
|
||||
return None
|
||||
|
||||
@callback
|
||||
def _async_update_callback(self):
|
||||
"""Update and write state."""
|
||||
|
Loading…
Reference in New Issue
Block a user