From 9ee81fdd772a29cb024f583c8b2c3a2c81a3621e Mon Sep 17 00:00:00 2001 From: Vincent Knoop Pathuis <48653141+vpathuis@users.noreply.github.com> Date: Wed, 28 Sep 2022 08:28:31 +0200 Subject: [PATCH] Landis+Gyr Heat Meter: add heat previous year GJ as diagnostic (#78690) Add heat previous year GJ as diagnostic --- homeassistant/components/landisgyr_heat_meter/const.py | 8 ++++++++ tests/components/landisgyr_heat_meter/test_sensor.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/landisgyr_heat_meter/const.py b/homeassistant/components/landisgyr_heat_meter/const.py index 55a6c65892c..57a8f9d9be4 100644 --- a/homeassistant/components/landisgyr_heat_meter/const.py +++ b/homeassistant/components/landisgyr_heat_meter/const.py @@ -44,6 +44,14 @@ HEAT_METER_SENSOR_TYPES = ( native_unit_of_measurement=ENERGY_MEGA_WATT_HOUR, entity_category=EntityCategory.DIAGNOSTIC, ), + # Diagnostic entity for debugging, this will match the value in GJ of previous year indicated on the meter's display + SensorEntityDescription( + key="heat_previous_year_gj", + icon="mdi:fire", + name="Heat previous year GJ", + native_unit_of_measurement="GJ", + entity_category=EntityCategory.DIAGNOSTIC, + ), SensorEntityDescription( key="volume_previous_year_m3", icon="mdi:fire", diff --git a/tests/components/landisgyr_heat_meter/test_sensor.py b/tests/components/landisgyr_heat_meter/test_sensor.py index 505efb446b8..1a068093d0e 100644 --- a/tests/components/landisgyr_heat_meter/test_sensor.py +++ b/tests/components/landisgyr_heat_meter/test_sensor.py @@ -76,7 +76,7 @@ async def test_create_sensors(mock_heat_meter, hass): await hass.async_block_till_done() # check if 26 attributes have been created - assert len(hass.states.async_all()) == 26 + assert len(hass.states.async_all()) == 27 entity_reg = entity_registry.async_get(hass) state = hass.states.get("sensor.heat_meter_heat_usage")