Skip to content

Commit

Permalink
Use total as state_class
Browse files Browse the repository at this point in the history
For some reason a warning is shown if we use `state_class=measurement` in the Energy Dashboard configuration.
See #18
  • Loading branch information
tijsverkoyen committed Dec 6, 2022
1 parent be3e43c commit 744f068
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import datetime

from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, STATE_CLASS_TOTAL_INCREASING, SensorEntity
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, STATE_CLASS_TOTAL_INCREASING, STATE_CLASS_TOTAL, \
SensorEntity
from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY, BinarySensorEntity
from homeassistant.const import DEVICE_CLASS_VOLTAGE, ELECTRIC_POTENTIAL_VOLT, DEVICE_CLASS_CURRENT, \
ELECTRIC_CURRENT_AMPERE, DEVICE_CLASS_ENERGY, DEVICE_CLASS_TEMPERATURE, \
Expand Down Expand Up @@ -169,11 +170,7 @@ def unit_of_measurement(self) -> str:

@property
def state_class(self) -> str:
return STATE_CLASS_MEASUREMENT

@property
def last_reset(self) -> None:
return None
return STATE_CLASS_TOTAL


class FusionSolarRealtimeDeviceDataEnergyTotalIncreasingSensor(FusionSolarRealtimeDeviceDataEnergySensor):
Expand Down

0 comments on commit 744f068

Please sign in to comment.