From b44e8673a8eb85c459817f1c314d40e063e593a7 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 9 Dec 2022 16:19:18 +0100 Subject: [PATCH] Use WATER device class in rainmachine (#83651) --- homeassistant/components/rainmachine/sensor.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/rainmachine/sensor.py b/homeassistant/components/rainmachine/sensor.py index 0830fe6bc6a..ba1ce24d472 100644 --- a/homeassistant/components/rainmachine/sensor.py +++ b/homeassistant/components/rainmachine/sensor.py @@ -14,7 +14,7 @@ from homeassistant.components.sensor import ( SensorStateClass, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import VOLUME_CUBIC_METERS, VOLUME_LITERS +from homeassistant.const import UnitOfVolume from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -72,7 +72,7 @@ SENSOR_DESCRIPTIONS = ( key=TYPE_FLOW_SENSOR_CLICK_M3, name="Flow sensor clicks per cubic meter", icon="mdi:water-pump", - native_unit_of_measurement=f"clicks/{VOLUME_CUBIC_METERS}", + native_unit_of_measurement=f"clicks/{UnitOfVolume.CUBIC_METERS}", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, state_class=SensorStateClass.MEASUREMENT, @@ -83,8 +83,9 @@ SENSOR_DESCRIPTIONS = ( key=TYPE_FLOW_SENSOR_CONSUMED_LITERS, name="Flow sensor consumed liters", icon="mdi:water-pump", + device_class=SensorDeviceClass.WATER, entity_category=EntityCategory.DIAGNOSTIC, - native_unit_of_measurement=VOLUME_LITERS, + native_unit_of_measurement=UnitOfVolume.LITERS, entity_registry_enabled_default=False, state_class=SensorStateClass.TOTAL_INCREASING, api_category=DATA_PROVISION_SETTINGS, @@ -105,8 +106,9 @@ SENSOR_DESCRIPTIONS = ( key=TYPE_FLOW_SENSOR_LEAK_VOLUME, name="Flow sensor leak volume", icon="mdi:pipe-leak", + device_class=SensorDeviceClass.WATER, entity_category=EntityCategory.DIAGNOSTIC, - native_unit_of_measurement=VOLUME_LITERS, + native_unit_of_measurement=UnitOfVolume.LITERS, entity_registry_enabled_default=False, state_class=SensorStateClass.TOTAL_INCREASING, api_category=DATA_PROVISION_SETTINGS,