From 9af97a54b7a9dfb091f4e48f0cd66f758e7e2629 Mon Sep 17 00:00:00 2001 From: BottlecapDave Date: Wed, 25 Dec 2024 03:40:59 +0000 Subject: [PATCH] fix: Fixed state class for current total consumption sensors (5 minutes dev time) --- .../electricity/current_total_consumption.py | 7 +------ .../gas/current_total_consumption_cubic_meters.py | 2 +- .../octopus_energy/gas/current_total_consumption_kwh.py | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/custom_components/octopus_energy/electricity/current_total_consumption.py b/custom_components/octopus_energy/electricity/current_total_consumption.py index e1efcbcf..e13c6273 100644 --- a/custom_components/octopus_energy/electricity/current_total_consumption.py +++ b/custom_components/octopus_energy/electricity/current_total_consumption.py @@ -65,7 +65,7 @@ def device_class(self): @property def state_class(self): """The state class of sensor""" - return SensorStateClass.TOTAL + return SensorStateClass.TOTAL_INCREASING @property def native_unit_of_measurement(self): @@ -82,11 +82,6 @@ def extra_state_attributes(self): """Attributes of the sensor.""" return self._attributes - @property - def last_reset(self): - """Return the time when the sensor was last reset, if any.""" - return self._last_reset - @property def native_value(self): return self._state diff --git a/custom_components/octopus_energy/gas/current_total_consumption_cubic_meters.py b/custom_components/octopus_energy/gas/current_total_consumption_cubic_meters.py index 703b967a..c3a308b0 100644 --- a/custom_components/octopus_energy/gas/current_total_consumption_cubic_meters.py +++ b/custom_components/octopus_energy/gas/current_total_consumption_cubic_meters.py @@ -67,7 +67,7 @@ def device_class(self): @property def state_class(self): """The state class of sensor""" - return SensorStateClass.TOTAL + return SensorStateClass.TOTAL_INCREASING @property def native_unit_of_measurement(self): diff --git a/custom_components/octopus_energy/gas/current_total_consumption_kwh.py b/custom_components/octopus_energy/gas/current_total_consumption_kwh.py index 66575d8c..503ded94 100644 --- a/custom_components/octopus_energy/gas/current_total_consumption_kwh.py +++ b/custom_components/octopus_energy/gas/current_total_consumption_kwh.py @@ -67,7 +67,7 @@ def device_class(self): @property def state_class(self): """The state class of sensor""" - return SensorStateClass.TOTAL + return SensorStateClass.TOTAL_INCREASING @property def native_unit_of_measurement(self):