Set water device class to flo, homewizard, p1_monitor, toon (#80944)
This commit is contained in:
parent
dbfca8def8
commit
5b32540a84
5 changed files with 8 additions and 3 deletions
|
@ -71,6 +71,7 @@ class FloDailyUsageSensor(FloEntity, SensorEntity):
|
|||
_attr_icon = WATER_ICON
|
||||
_attr_native_unit_of_measurement = VOLUME_GALLONS
|
||||
_attr_state_class: SensorStateClass = SensorStateClass.TOTAL_INCREASING
|
||||
_attr_device_class = SensorDeviceClass.WATER
|
||||
|
||||
def __init__(self, device):
|
||||
"""Initialize the daily water usage sensor."""
|
||||
|
|
|
@ -131,7 +131,7 @@ SENSORS: Final[tuple[SensorEntityDescription, ...]] = (
|
|||
name="Total water usage",
|
||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
||||
icon="mdi:gauge",
|
||||
device_class=SensorDeviceClass.VOLUME,
|
||||
device_class=SensorDeviceClass.WATER,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
),
|
||||
)
|
||||
|
|
|
@ -222,13 +222,14 @@ SENSORS_WATERMETER: tuple[SensorEntityDescription, ...] = (
|
|||
name="Consumption Day",
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
native_unit_of_measurement=VOLUME_LITERS,
|
||||
device_class=SensorDeviceClass.VOLUME,
|
||||
device_class=SensorDeviceClass.WATER,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="consumption_total",
|
||||
name="Consumption Total",
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
||||
device_class=SensorDeviceClass.WATER,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="pulse_count",
|
||||
|
|
|
@ -316,6 +316,7 @@ SENSOR_ENTITIES: tuple[ToonSensorEntityDescription, ...] = (
|
|||
icon="mdi:water",
|
||||
entity_registry_enabled_default=False,
|
||||
cls=ToonWaterMeterDeviceSensor,
|
||||
device_class=SensorDeviceClass.WATER,
|
||||
),
|
||||
ToonSensorEntityDescription(
|
||||
key="water_daily_usage",
|
||||
|
@ -326,6 +327,7 @@ SENSOR_ENTITIES: tuple[ToonSensorEntityDescription, ...] = (
|
|||
icon="mdi:water",
|
||||
entity_registry_enabled_default=False,
|
||||
cls=ToonWaterMeterDeviceSensor,
|
||||
device_class=SensorDeviceClass.WATER,
|
||||
),
|
||||
ToonSensorEntityDescription(
|
||||
key="water_meter_reading",
|
||||
|
@ -337,6 +339,7 @@ SENSOR_ENTITIES: tuple[ToonSensorEntityDescription, ...] = (
|
|||
entity_registry_enabled_default=False,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
cls=ToonWaterMeterDeviceSensor,
|
||||
device_class=SensorDeviceClass.WATER,
|
||||
),
|
||||
ToonSensorEntityDescription(
|
||||
key="water_value",
|
||||
|
|
|
@ -609,7 +609,7 @@ async def test_sensor_entity_total_liters(
|
|||
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == VOLUME_CUBIC_METERS
|
||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.VOLUME
|
||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.WATER
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:gauge"
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue