From 08a3e2b2230e98526fa469bb40ec6267f3498e48 Mon Sep 17 00:00:00 2001 From: Mike Salway <38225053+msalway@users.noreply.github.com> Date: Sat, 20 Jan 2024 15:20:40 +0000 Subject: [PATCH] Set state_class for battery sensor to enable historic stats --- custom_components/wiser/sensor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom_components/wiser/sensor.py b/custom_components/wiser/sensor.py index 996336f..e01d522 100755 --- a/custom_components/wiser/sensor.py +++ b/custom_components/wiser/sensor.py @@ -286,6 +286,10 @@ def device_class(self): """Return the class of the sensor.""" return SensorDeviceClass.BATTERY + @property + def state_class(self): + return SensorStateClass.MEASUREMENT + @property def native_unit_of_measurement(self): """Return the unit of measurement of this entity."""