Skip to content

Commit

Permalink
Add long-term statistics for Tado sensors (#58111)
Browse files Browse the repository at this point in the history
  • Loading branch information
Noltari committed Oct 22, 2021
1 parent c0934ce commit f740302
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion homeassistant/components/tado/sensor.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -153,6 +153,13 @@ def device_class(self):
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."""
Expand Down Expand Up @@ -259,6 +266,13 @@ def device_class(self):
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."""
Expand Down

0 comments on commit f740302

Please sign in to comment.