Add long-term statistics support for rain sensors (#56847)

This commit is contained in:
Tobias Sauerwein 2021-10-01 07:24:55 +02:00 committed by GitHub
parent 25b76964a5
commit 7560c7b3de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import pyatmo
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
) )
@ -143,6 +144,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
netatmo_name="Rain", netatmo_name="Rain",
entity_registry_enabled_default=True, entity_registry_enabled_default=True,
native_unit_of_measurement=LENGTH_MILLIMETERS, native_unit_of_measurement=LENGTH_MILLIMETERS,
state_class=STATE_CLASS_MEASUREMENT,
icon="mdi:weather-rainy", icon="mdi:weather-rainy",
), ),
NetatmoSensorEntityDescription( NetatmoSensorEntityDescription(
@ -151,6 +153,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
netatmo_name="sum_rain_1", netatmo_name="sum_rain_1",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
native_unit_of_measurement=LENGTH_MILLIMETERS, native_unit_of_measurement=LENGTH_MILLIMETERS,
state_class=STATE_CLASS_TOTAL_INCREASING,
icon="mdi:weather-rainy", icon="mdi:weather-rainy",
), ),
NetatmoSensorEntityDescription( NetatmoSensorEntityDescription(
@ -159,6 +162,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
netatmo_name="sum_rain_24", netatmo_name="sum_rain_24",
entity_registry_enabled_default=True, entity_registry_enabled_default=True,
native_unit_of_measurement=LENGTH_MILLIMETERS, native_unit_of_measurement=LENGTH_MILLIMETERS,
state_class=STATE_CLASS_TOTAL_INCREASING,
icon="mdi:weather-rainy", icon="mdi:weather-rainy",
), ),
NetatmoSensorEntityDescription( NetatmoSensorEntityDescription(