Add support for water usage Flume (#81041)

This commit is contained in:
Franck Nijhof 2022-10-26 21:04:41 +02:00 committed by GitHub
parent 0321c8bdc5
commit a603441180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,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 VOLUME_GALLONS from homeassistant.const import VOLUME_GALLONS
@ -40,34 +41,40 @@ FLUME_QUERIES_SENSOR: tuple[SensorEntityDescription, ...] = (
key="month_to_date", key="month_to_date",
name="Current Month", name="Current Month",
native_unit_of_measurement=VOLUME_GALLONS, native_unit_of_measurement=VOLUME_GALLONS,
device_class=SensorDeviceClass.VOLUME, device_class=SensorDeviceClass.WATER,
state_class=SensorStateClass.TOTAL_INCREASING,
), ),
SensorEntityDescription( SensorEntityDescription(
key="week_to_date", key="week_to_date",
name="Current Week", name="Current Week",
native_unit_of_measurement=VOLUME_GALLONS, native_unit_of_measurement=VOLUME_GALLONS,
device_class=SensorDeviceClass.VOLUME, device_class=SensorDeviceClass.WATER,
state_class=SensorStateClass.TOTAL_INCREASING,
), ),
SensorEntityDescription( SensorEntityDescription(
key="today", key="today",
name="Current Day", name="Current Day",
native_unit_of_measurement=VOLUME_GALLONS, native_unit_of_measurement=VOLUME_GALLONS,
device_class=SensorDeviceClass.VOLUME, device_class=SensorDeviceClass.WATER,
state_class=SensorStateClass.TOTAL_INCREASING,
), ),
SensorEntityDescription( SensorEntityDescription(
key="last_60_min", key="last_60_min",
name="60 Minutes", name="60 Minutes",
native_unit_of_measurement=f"{VOLUME_GALLONS}/h", native_unit_of_measurement=f"{VOLUME_GALLONS}/h",
state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="last_24_hrs", key="last_24_hrs",
name="24 Hours", name="24 Hours",
native_unit_of_measurement=f"{VOLUME_GALLONS}/d", native_unit_of_measurement=f"{VOLUME_GALLONS}/d",
state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="last_30_days", key="last_30_days",
name="30 Days", name="30 Days",
native_unit_of_measurement=f"{VOLUME_GALLONS}/mo", native_unit_of_measurement=f"{VOLUME_GALLONS}/mo",
state_class=SensorStateClass.MEASUREMENT,
), ),
) )