diff --git a/homeassistant/components/flo/sensor.py b/homeassistant/components/flo/sensor.py index e7fbd293bd101e82e096895540d0a12c6f405aa4..9f793b749e46000636effcb538e4413ae396419d 100644 --- a/homeassistant/components/flo/sensor.py +++ b/homeassistant/components/flo/sensor.py @@ -67,6 +67,7 @@ async def async_setup_entry( class FloDailyUsageSensor(FloEntity, SensorEntity): """Monitors the daily water usage.""" + _attr_device_class = SensorDeviceClass.VOLUME _attr_icon = WATER_ICON _attr_native_unit_of_measurement = VOLUME_GALLONS _attr_state_class: SensorStateClass = SensorStateClass.TOTAL_INCREASING diff --git a/homeassistant/components/justnimbus/sensor.py b/homeassistant/components/justnimbus/sensor.py index 73a68ac91395600ac3a5667cb644f65429d93369..41f1e81d5b32b5209e93f55a4b84a8019e7eea01 100644 --- a/homeassistant/components/justnimbus/sensor.py +++ b/homeassistant/components/justnimbus/sensor.py @@ -103,6 +103,7 @@ SENSOR_TYPES = ( name="Reservoir content", icon="mdi:car-coolant-level", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda coordinator: coordinator.data.reservoir_content, @@ -112,6 +113,7 @@ SENSOR_TYPES = ( name="Total saved", icon="mdi:water-opacity", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda coordinator: coordinator.data.total_saved, @@ -121,6 +123,7 @@ SENSOR_TYPES = ( name="Total replenished", icon="mdi:water", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda coordinator: coordinator.data.total_replenished, @@ -138,6 +141,7 @@ SENSOR_TYPES = ( name="Total use", icon="mdi:chart-donut", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda coordinator: coordinator.data.totver, @@ -147,6 +151,7 @@ SENSOR_TYPES = ( name="Max reservoir content", icon="mdi:waves", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.TOTAL, entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda coordinator: coordinator.data.reservoir_content_max, diff --git a/homeassistant/components/kegtron/sensor.py b/homeassistant/components/kegtron/sensor.py index f52a7c796347dead6eee22bbcda3fbf0108969cc..892d8651185ed8d34a94cb96bdd0ace63a8fd785 100644 --- a/homeassistant/components/kegtron/sensor.py +++ b/homeassistant/components/kegtron/sensor.py @@ -39,6 +39,7 @@ SENSOR_DESCRIPTIONS = { key=KegtronSensorDeviceClass.KEG_SIZE, icon="mdi:keg", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.MEASUREMENT, ), KegtronSensorDeviceClass.KEG_TYPE: SensorEntityDescription( @@ -49,12 +50,14 @@ SENSOR_DESCRIPTIONS = { key=KegtronSensorDeviceClass.VOLUME_START, icon="mdi:keg", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.MEASUREMENT, ), KegtronSensorDeviceClass.VOLUME_DISPENSED: SensorEntityDescription( key=KegtronSensorDeviceClass.VOLUME_DISPENSED, icon="mdi:keg", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.TOTAL, ), KegtronSensorDeviceClass.PORT_STATE: SensorEntityDescription( diff --git a/homeassistant/components/overkiz/sensor.py b/homeassistant/components/overkiz/sensor.py index 83f123eaad768e18a3a94fc7c6240e7f57792e9d..e80e08e263ad57efc360d99c508d86cf6958e5cb 100644 --- a/homeassistant/components/overkiz/sensor.py +++ b/homeassistant/components/overkiz/sensor.py @@ -90,6 +90,7 @@ SENSOR_DESCRIPTIONS: list[OverkizSensorDescription] = [ name="Water volume estimation at 40 °C", icon="mdi:water", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, ), @@ -98,6 +99,7 @@ SENSOR_DESCRIPTIONS: list[OverkizSensorDescription] = [ name="Water consumption", icon="mdi:water", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.MEASUREMENT, ), OverkizSensorDescription( @@ -105,6 +107,7 @@ SENSOR_DESCRIPTIONS: list[OverkizSensorDescription] = [ name="Outlet engine", icon="mdi:fan-chevron-down", native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.MEASUREMENT, ), OverkizSensorDescription( diff --git a/homeassistant/components/p1_monitor/sensor.py b/homeassistant/components/p1_monitor/sensor.py index 757bf249ca1d1c29935379e294e5677da469863e..e55c8dacea5b0767267c69659b3cf6c8a3f33948 100644 --- a/homeassistant/components/p1_monitor/sensor.py +++ b/homeassistant/components/p1_monitor/sensor.py @@ -222,6 +222,7 @@ SENSORS_WATERMETER: tuple[SensorEntityDescription, ...] = ( name="Consumption Day", state_class=SensorStateClass.TOTAL_INCREASING, native_unit_of_measurement=VOLUME_LITERS, + device_class=SensorDeviceClass.VOLUME, ), SensorEntityDescription( key="consumption_total", diff --git a/homeassistant/components/streamlabswater/sensor.py b/homeassistant/components/streamlabswater/sensor.py index afef8070fcbfb5521c7695467a1ad5b0e9a34a4e..1a1070d1ea83d7b2a3ec3358b4a8519820e48342 100644 --- a/homeassistant/components/streamlabswater/sensor.py +++ b/homeassistant/components/streamlabswater/sensor.py @@ -3,7 +3,7 @@ from __future__ import annotations from datetime import timedelta -from homeassistant.components.sensor import SensorEntity +from homeassistant.components.sensor import SensorDeviceClass, SensorEntity from homeassistant.const import VOLUME_GALLONS from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -80,6 +80,8 @@ class StreamlabsUsageData: class StreamLabsDailyUsage(SensorEntity): """Monitors the daily water usage.""" + _attr_device_class = SensorDeviceClass.VOLUME + def __init__(self, location_name, streamlabs_usage_data): """Initialize the daily water usage device.""" self._location_name = location_name diff --git a/homeassistant/components/suez_water/sensor.py b/homeassistant/components/suez_water/sensor.py index ac6918292361dd50cc5bb1c043694ed06b7c5f81..77b1de6555e33ff1ea4390cf5e2e56a1b28e08fd 100644 --- a/homeassistant/components/suez_water/sensor.py +++ b/homeassistant/components/suez_water/sensor.py @@ -8,7 +8,11 @@ from pysuez import SuezClient from pysuez.client import PySuezError import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity +from homeassistant.components.sensor import ( + PLATFORM_SCHEMA, + SensorDeviceClass, + SensorEntity, +) from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, VOLUME_LITERS from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -63,6 +67,7 @@ class SuezSensor(SensorEntity): _attr_name = NAME _attr_icon = ICON _attr_native_unit_of_measurement = VOLUME_LITERS + _attr_device_class = SensorDeviceClass.VOLUME def __init__(self, client): """Initialize the data object.""" diff --git a/homeassistant/components/surepetcare/sensor.py b/homeassistant/components/surepetcare/sensor.py index e996705490076e25472113d7016e39681525d69a..1ae227100609a13023bc96446a4a23ffc8ebfac2 100644 --- a/homeassistant/components/surepetcare/sensor.py +++ b/homeassistant/components/surepetcare/sensor.py @@ -87,6 +87,7 @@ class SureBattery(SurePetcareEntity, SensorEntity): class Felaqua(SurePetcareEntity, SensorEntity): """Sure Petcare Felaqua.""" + _attr_device_class = SensorDeviceClass.VOLUME _attr_native_unit_of_measurement = VOLUME_MILLILITERS def __init__(