mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Set water device class to flo, homewizard, p1_monitor, toon (#80944)
This commit is contained in:
parent
dbfca8def8
commit
5b32540a84
@ -71,6 +71,7 @@ class FloDailyUsageSensor(FloEntity, SensorEntity):
|
|||||||
_attr_icon = WATER_ICON
|
_attr_icon = WATER_ICON
|
||||||
_attr_native_unit_of_measurement = VOLUME_GALLONS
|
_attr_native_unit_of_measurement = VOLUME_GALLONS
|
||||||
_attr_state_class: SensorStateClass = SensorStateClass.TOTAL_INCREASING
|
_attr_state_class: SensorStateClass = SensorStateClass.TOTAL_INCREASING
|
||||||
|
_attr_device_class = SensorDeviceClass.WATER
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the daily water usage sensor."""
|
"""Initialize the daily water usage sensor."""
|
||||||
|
@ -131,7 +131,7 @@ SENSORS: Final[tuple[SensorEntityDescription, ...]] = (
|
|||||||
name="Total water usage",
|
name="Total water usage",
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
||||||
icon="mdi:gauge",
|
icon="mdi:gauge",
|
||||||
device_class=SensorDeviceClass.VOLUME,
|
device_class=SensorDeviceClass.WATER,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -222,13 +222,14 @@ SENSORS_WATERMETER: tuple[SensorEntityDescription, ...] = (
|
|||||||
name="Consumption Day",
|
name="Consumption Day",
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
native_unit_of_measurement=VOLUME_LITERS,
|
native_unit_of_measurement=VOLUME_LITERS,
|
||||||
device_class=SensorDeviceClass.VOLUME,
|
device_class=SensorDeviceClass.WATER,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="consumption_total",
|
key="consumption_total",
|
||||||
name="Consumption Total",
|
name="Consumption Total",
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
||||||
|
device_class=SensorDeviceClass.WATER,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="pulse_count",
|
key="pulse_count",
|
||||||
|
@ -316,6 +316,7 @@ SENSOR_ENTITIES: tuple[ToonSensorEntityDescription, ...] = (
|
|||||||
icon="mdi:water",
|
icon="mdi:water",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
cls=ToonWaterMeterDeviceSensor,
|
cls=ToonWaterMeterDeviceSensor,
|
||||||
|
device_class=SensorDeviceClass.WATER,
|
||||||
),
|
),
|
||||||
ToonSensorEntityDescription(
|
ToonSensorEntityDescription(
|
||||||
key="water_daily_usage",
|
key="water_daily_usage",
|
||||||
@ -326,6 +327,7 @@ SENSOR_ENTITIES: tuple[ToonSensorEntityDescription, ...] = (
|
|||||||
icon="mdi:water",
|
icon="mdi:water",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
cls=ToonWaterMeterDeviceSensor,
|
cls=ToonWaterMeterDeviceSensor,
|
||||||
|
device_class=SensorDeviceClass.WATER,
|
||||||
),
|
),
|
||||||
ToonSensorEntityDescription(
|
ToonSensorEntityDescription(
|
||||||
key="water_meter_reading",
|
key="water_meter_reading",
|
||||||
@ -337,6 +339,7 @@ SENSOR_ENTITIES: tuple[ToonSensorEntityDescription, ...] = (
|
|||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
cls=ToonWaterMeterDeviceSensor,
|
cls=ToonWaterMeterDeviceSensor,
|
||||||
|
device_class=SensorDeviceClass.WATER,
|
||||||
),
|
),
|
||||||
ToonSensorEntityDescription(
|
ToonSensorEntityDescription(
|
||||||
key="water_value",
|
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_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING
|
||||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == VOLUME_CUBIC_METERS
|
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"
|
assert state.attributes.get(ATTR_ICON) == "mdi:gauge"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user