From 89ff16b52cbbf5208abbce3194f51e351c46c82f Mon Sep 17 00:00:00 2001 From: Tim Empringham Date: Tue, 28 Feb 2023 17:48:00 -0500 Subject: [PATCH] Move state_class to class attribute. --- custom_components/googlewifi/sensor.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/custom_components/googlewifi/sensor.py b/custom_components/googlewifi/sensor.py index 35fd19a..8cd0c11 100644 --- a/custom_components/googlewifi/sensor.py +++ b/custom_components/googlewifi/sensor.py @@ -148,6 +148,8 @@ def __init__( self.attrs = {} self._unit_of_measurement = unit_of_measure + _attr_state_class = SensorStateClass.MEASUREMENT + @property def unique_id(self): """Return the unique id for this sensor.""" @@ -178,11 +180,6 @@ def state(self): self._state = unit_convert(self._state, self._unit_of_measurement) return self._state - - @property - def state_class(self): - """Return the state class of total for the sensors.""" - return SensorStateClass.MEASUREMENT @property def unit_of_measurement(self):