Use WATER device class in rainmachine (#83651)

This commit is contained in:
epenet 2022-12-09 16:19:18 +01:00 committed by GitHub
parent 5d31673465
commit b44e8673a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@ from homeassistant.components.sensor import (
SensorStateClass, SensorStateClass,
) )
from homeassistant.config_entries import ConfigEntry 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.core import HomeAssistant, callback
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -72,7 +72,7 @@ SENSOR_DESCRIPTIONS = (
key=TYPE_FLOW_SENSOR_CLICK_M3, key=TYPE_FLOW_SENSOR_CLICK_M3,
name="Flow sensor clicks per cubic meter", name="Flow sensor clicks per cubic meter",
icon="mdi:water-pump", 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_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
@ -83,8 +83,9 @@ SENSOR_DESCRIPTIONS = (
key=TYPE_FLOW_SENSOR_CONSUMED_LITERS, key=TYPE_FLOW_SENSOR_CONSUMED_LITERS,
name="Flow sensor consumed liters", name="Flow sensor consumed liters",
icon="mdi:water-pump", icon="mdi:water-pump",
device_class=SensorDeviceClass.WATER,
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=VOLUME_LITERS, native_unit_of_measurement=UnitOfVolume.LITERS,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
api_category=DATA_PROVISION_SETTINGS, api_category=DATA_PROVISION_SETTINGS,
@ -105,8 +106,9 @@ SENSOR_DESCRIPTIONS = (
key=TYPE_FLOW_SENSOR_LEAK_VOLUME, key=TYPE_FLOW_SENSOR_LEAK_VOLUME,
name="Flow sensor leak volume", name="Flow sensor leak volume",
icon="mdi:pipe-leak", icon="mdi:pipe-leak",
device_class=SensorDeviceClass.WATER,
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=VOLUME_LITERS, native_unit_of_measurement=UnitOfVolume.LITERS,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
api_category=DATA_PROVISION_SETTINGS, api_category=DATA_PROVISION_SETTINGS,