Add long-term statistics for Ondilo ICO (#58290)

This commit is contained in:
TheNogl 2021-10-24 11:52:25 +02:00 committed by GitHub
parent 6f0c1d2345
commit 0f965c6b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,11 @@ import logging
from ondilo import OndiloError 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 ( from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION, CONCENTRATION_PARTS_PER_MILLION,
DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY,
@ -32,6 +36,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
icon=None, icon=None,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="orp", key="orp",
@ -39,6 +44,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
native_unit_of_measurement=ELECTRIC_POTENTIAL_MILLIVOLT, native_unit_of_measurement=ELECTRIC_POTENTIAL_MILLIVOLT,
icon="mdi:pool", icon="mdi:pool",
device_class=None, device_class=None,
state_class=STATE_CLASS_MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="ph", key="ph",
@ -46,6 +52,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
native_unit_of_measurement=None, native_unit_of_measurement=None,
icon="mdi:pool", icon="mdi:pool",
device_class=None, device_class=None,
state_class=STATE_CLASS_MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="tds", key="tds",
@ -53,6 +60,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
icon="mdi:pool", icon="mdi:pool",
device_class=None, device_class=None,
state_class=STATE_CLASS_MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="battery", key="battery",
@ -60,6 +68,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
icon=None, icon=None,
device_class=DEVICE_CLASS_BATTERY, device_class=DEVICE_CLASS_BATTERY,
state_class=STATE_CLASS_MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="rssi", key="rssi",
@ -67,6 +76,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
icon=None, icon=None,
device_class=DEVICE_CLASS_SIGNAL_STRENGTH, device_class=DEVICE_CLASS_SIGNAL_STRENGTH,
state_class=STATE_CLASS_MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="salt", key="salt",
@ -74,6 +84,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
native_unit_of_measurement="mg/L", native_unit_of_measurement="mg/L",
icon="mdi:pool", icon="mdi:pool",
device_class=None, device_class=None,
state_class=STATE_CLASS_MEASUREMENT,
), ),
) )