From e00f04c2c3081a0605e6dafd9d3b8f2962bb4429 Mon Sep 17 00:00:00 2001 From: Henne <65833107+HennieLP@users.noreply.github.com> Date: Sat, 8 Oct 2022 01:54:50 +0200 Subject: [PATCH] Add state class to bosch_shc energy sensor (#79470) Make That energy sensor works in Dashbord --- homeassistant/components/bosch_shc/sensor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/bosch_shc/sensor.py b/homeassistant/components/bosch_shc/sensor.py index 331a5ebb5f3..cb8272e92cf 100644 --- a/homeassistant/components/bosch_shc/sensor.py +++ b/homeassistant/components/bosch_shc/sensor.py @@ -4,7 +4,11 @@ from __future__ import annotations from boschshcpy import SHCSession from boschshcpy.device import SHCDevice -from homeassistant.components.sensor import SensorDeviceClass, SensorEntity +from homeassistant.components.sensor import ( + SensorDeviceClass, + SensorEntity, + SensorStateClass, +) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, @@ -317,6 +321,7 @@ class EnergySensor(SHCEntity, SensorEntity): """Representation of an SHC energy reporting sensor.""" _attr_device_class = SensorDeviceClass.ENERGY + _attr_state_class = SensorStateClass.TOTAL_INCREASING _attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None: