From 0f965c6b31fcb94f3bfcce69d89a570e3ed9861d Mon Sep 17 00:00:00 2001 From: TheNogl <19914064+TheNogl@users.noreply.github.com> Date: Sun, 24 Oct 2021 11:52:25 +0200 Subject: [PATCH] Add long-term statistics for Ondilo ICO (#58290) --- homeassistant/components/ondilo_ico/sensor.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/ondilo_ico/sensor.py b/homeassistant/components/ondilo_ico/sensor.py index e02682ae298..e0a07c6fe26 100644 --- a/homeassistant/components/ondilo_ico/sensor.py +++ b/homeassistant/components/ondilo_ico/sensor.py @@ -6,7 +6,11 @@ import logging from ondilo import OndiloError -from homeassistant.components.sensor import SensorEntity, SensorEntityDescription +from homeassistant.components.sensor import ( + STATE_CLASS_MEASUREMENT, + SensorEntity, + SensorEntityDescription, +) from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, DEVICE_CLASS_BATTERY, @@ -32,6 +36,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( native_unit_of_measurement=TEMP_CELSIUS, icon=None, device_class=DEVICE_CLASS_TEMPERATURE, + state_class=STATE_CLASS_MEASUREMENT, ), SensorEntityDescription( key="orp", @@ -39,6 +44,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( native_unit_of_measurement=ELECTRIC_POTENTIAL_MILLIVOLT, icon="mdi:pool", device_class=None, + state_class=STATE_CLASS_MEASUREMENT, ), SensorEntityDescription( key="ph", @@ -46,6 +52,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( native_unit_of_measurement=None, icon="mdi:pool", device_class=None, + state_class=STATE_CLASS_MEASUREMENT, ), SensorEntityDescription( key="tds", @@ -53,6 +60,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, icon="mdi:pool", device_class=None, + state_class=STATE_CLASS_MEASUREMENT, ), SensorEntityDescription( key="battery", @@ -60,6 +68,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( native_unit_of_measurement=PERCENTAGE, icon=None, device_class=DEVICE_CLASS_BATTERY, + state_class=STATE_CLASS_MEASUREMENT, ), SensorEntityDescription( key="rssi", @@ -67,6 +76,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( native_unit_of_measurement=PERCENTAGE, icon=None, device_class=DEVICE_CLASS_SIGNAL_STRENGTH, + state_class=STATE_CLASS_MEASUREMENT, ), SensorEntityDescription( key="salt", @@ -74,6 +84,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( native_unit_of_measurement="mg/L", icon="mdi:pool", device_class=None, + state_class=STATE_CLASS_MEASUREMENT, ), )