Update litterrobot integration to support long-term statistics (#83269)

This commit is contained in:
Alice 2022-12-05 10:12:58 -06:00 committed by GitHub
parent 1011c30cc5
commit b97f95efc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,7 @@ from homeassistant.components.sensor import (
SensorDeviceClass, SensorDeviceClass,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
SensorStateClass,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import MASS_POUNDS, PERCENTAGE from homeassistant.const import MASS_POUNDS, PERCENTAGE
@ -73,6 +74,7 @@ ROBOT_SENSOR_MAP: dict[type[Robot], list[RobotSensorEntityDescription]] = {
name="Waste Drawer", name="Waste Drawer",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
icon_fn=lambda state: icon_for_gauge_level(state, 10), icon_fn=lambda state: icon_for_gauge_level(state, 10),
state_class=SensorStateClass.MEASUREMENT,
), ),
RobotSensorEntityDescription[LitterRobot]( RobotSensorEntityDescription[LitterRobot](
key="sleep_mode_start_time", key="sleep_mode_start_time",
@ -105,12 +107,14 @@ ROBOT_SENSOR_MAP: dict[type[Robot], list[RobotSensorEntityDescription]] = {
name="Litter level", name="Litter level",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
icon_fn=lambda state: icon_for_gauge_level(state, 10), icon_fn=lambda state: icon_for_gauge_level(state, 10),
state_class=SensorStateClass.MEASUREMENT,
), ),
RobotSensorEntityDescription[LitterRobot4]( RobotSensorEntityDescription[LitterRobot4](
key="pet_weight", key="pet_weight",
name="Pet weight", name="Pet weight",
native_unit_of_measurement=MASS_POUNDS, native_unit_of_measurement=MASS_POUNDS,
device_class=SensorDeviceClass.WEIGHT, device_class=SensorDeviceClass.WEIGHT,
state_class=SensorStateClass.MEASUREMENT,
), ),
], ],
FeederRobot: [ FeederRobot: [
@ -119,6 +123,7 @@ ROBOT_SENSOR_MAP: dict[type[Robot], list[RobotSensorEntityDescription]] = {
name="Food level", name="Food level",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
icon_fn=lambda state: icon_for_gauge_level(state, 10), icon_fn=lambda state: icon_for_gauge_level(state, 10),
state_class=SensorStateClass.MEASUREMENT,
) )
], ],
} }