From cb578c71e03e0187b5fc6a516e5d9ec11421a8e1 Mon Sep 17 00:00:00 2001 From: Vincent Knoop Pathuis <48653141+vpathuis@users.noreply.github.com> Date: Thu, 23 Mar 2023 17:21:21 +0100 Subject: [PATCH] Add Landis+Gyr missing device class (#90182) Add missing device class for heat_previous_year_gj --- homeassistant/components/landisgyr_heat_meter/sensor.py | 1 + tests/components/landisgyr_heat_meter/snapshots/test_sensor.ambr | 1 + 2 files changed, 2 insertions(+) diff --git a/homeassistant/components/landisgyr_heat_meter/sensor.py b/homeassistant/components/landisgyr_heat_meter/sensor.py index af966297421..244515a07d4 100644 --- a/homeassistant/components/landisgyr_heat_meter/sensor.py +++ b/homeassistant/components/landisgyr_heat_meter/sensor.py @@ -77,6 +77,7 @@ HEAT_METER_SENSOR_TYPES = ( icon="mdi:fire", name="Heat previous year GJ", native_unit_of_measurement=UnitOfEnergy.GIGA_JOULE, + device_class=SensorDeviceClass.ENERGY, entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda res: getattr(res, "heat_previous_year_gj", None), ), diff --git a/tests/components/landisgyr_heat_meter/snapshots/test_sensor.ambr b/tests/components/landisgyr_heat_meter/snapshots/test_sensor.ambr index e149073d9c8..9c62ca3f94b 100644 --- a/tests/components/landisgyr_heat_meter/snapshots/test_sensor.ambr +++ b/tests/components/landisgyr_heat_meter/snapshots/test_sensor.ambr @@ -31,6 +31,7 @@ }), StateSnapshot({ 'attributes': ReadOnlyDict({ + 'device_class': 'energy', 'friendly_name': 'Heat Meter Heat previous year GJ', 'icon': 'mdi:fire', 'unit_of_measurement': ,