From a6034411809e6b06954a58aca5134eef5bd4c9a0 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 26 Oct 2022 21:04:41 +0200 Subject: [PATCH] Add support for water usage Flume (#81041) --- homeassistant/components/flume/sensor.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/flume/sensor.py b/homeassistant/components/flume/sensor.py index 703744c248e..5b8dbde69e4 100644 --- a/homeassistant/components/flume/sensor.py +++ b/homeassistant/components/flume/sensor.py @@ -7,6 +7,7 @@ from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription, + SensorStateClass, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import VOLUME_GALLONS @@ -40,34 +41,40 @@ FLUME_QUERIES_SENSOR: tuple[SensorEntityDescription, ...] = ( key="month_to_date", name="Current Month", native_unit_of_measurement=VOLUME_GALLONS, - device_class=SensorDeviceClass.VOLUME, + device_class=SensorDeviceClass.WATER, + state_class=SensorStateClass.TOTAL_INCREASING, ), SensorEntityDescription( key="week_to_date", name="Current Week", native_unit_of_measurement=VOLUME_GALLONS, - device_class=SensorDeviceClass.VOLUME, + device_class=SensorDeviceClass.WATER, + state_class=SensorStateClass.TOTAL_INCREASING, ), SensorEntityDescription( key="today", name="Current Day", native_unit_of_measurement=VOLUME_GALLONS, - device_class=SensorDeviceClass.VOLUME, + device_class=SensorDeviceClass.WATER, + state_class=SensorStateClass.TOTAL_INCREASING, ), SensorEntityDescription( key="last_60_min", name="60 Minutes", native_unit_of_measurement=f"{VOLUME_GALLONS}/h", + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="last_24_hrs", name="24 Hours", native_unit_of_measurement=f"{VOLUME_GALLONS}/d", + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="last_30_days", name="30 Days", native_unit_of_measurement=f"{VOLUME_GALLONS}/mo", + state_class=SensorStateClass.MEASUREMENT, ), )