Add long-term statistics for RainMachine sensors (#55418)

* Add long-term statistics for RainMachine sensors

* Code review
This commit is contained in:
Aaron Bach 2021-09-14 14:06:40 -06:00 committed by GitHub
parent 4b2ff0a0ba
commit 2c348dd2d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -4,7 +4,12 @@ from __future__ import annotations
from dataclasses import dataclass
from functools import partial
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_TEMPERATURE,
@ -45,6 +50,7 @@ SENSOR_DESCRIPTIONS = (
icon="mdi:water-pump",
native_unit_of_measurement=f"clicks/{VOLUME_CUBIC_METERS}",
entity_registry_enabled_default=False,
state_class=STATE_CLASS_MEASUREMENT,
api_category=DATA_PROVISION_SETTINGS,
),
RainMachineSensorEntityDescription(
@ -53,6 +59,7 @@ SENSOR_DESCRIPTIONS = (
icon="mdi:water-pump",
native_unit_of_measurement="liter",
entity_registry_enabled_default=False,
state_class=STATE_CLASS_TOTAL_INCREASING,
api_category=DATA_PROVISION_SETTINGS,
),
RainMachineSensorEntityDescription(
@ -69,6 +76,7 @@ SENSOR_DESCRIPTIONS = (
icon="mdi:water-pump",
native_unit_of_measurement="clicks",
entity_registry_enabled_default=False,
state_class=STATE_CLASS_MEASUREMENT,
api_category=DATA_PROVISION_SETTINGS,
),
RainMachineSensorEntityDescription(
@ -77,6 +85,7 @@ SENSOR_DESCRIPTIONS = (
icon="mdi:thermometer",
native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
api_category=DATA_RESTRICTIONS_UNIVERSAL,
),
)