From aa6f15b1e2342af494ac98dd1d567a6444c52e19 Mon Sep 17 00:00:00 2001 From: Duco Sebel <74970928+DCSBL@users.noreply.github.com> Date: Fri, 30 Sep 2022 03:51:18 +0200 Subject: [PATCH] Use SensorDeviceClass.VOLUME in HomeWizard (#79323) Co-authored-by: Paulus Schoutsen --- homeassistant/components/homewizard/sensor.py | 2 +- tests/components/homewizard/test_sensor.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/homewizard/sensor.py b/homeassistant/components/homewizard/sensor.py index a66a2664ae1..df4eb0c4880 100644 --- a/homeassistant/components/homewizard/sensor.py +++ b/homeassistant/components/homewizard/sensor.py @@ -130,7 +130,7 @@ SENSORS: Final[tuple[SensorEntityDescription, ...]] = ( key="total_liter_m3", name="Total water usage", native_unit_of_measurement=VOLUME_CUBIC_METERS, - icon="mdi:gauge", + device_class=SensorDeviceClass.VOLUME, state_class=SensorStateClass.TOTAL_INCREASING, ), ) diff --git a/tests/components/homewizard/test_sensor.py b/tests/components/homewizard/test_sensor.py index 145a2719b01..7d350764b2b 100644 --- a/tests/components/homewizard/test_sensor.py +++ b/tests/components/homewizard/test_sensor.py @@ -609,8 +609,8 @@ 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 ATTR_DEVICE_CLASS not in state.attributes - assert state.attributes.get(ATTR_ICON) == "mdi:gauge" + assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.VOLUME + assert state.attributes.get(ATTR_ICON) is None async def test_sensor_entity_disabled_when_null(