Skip to content

Commit

Permalink
Remove last_reset attribute and set state class to `total_increasin…
Browse files Browse the repository at this point in the history
…g` for powerwall energy sensors (home-assistant#54808)
  • Loading branch information
emontnemery authored Aug 18, 2021
1 parent 3e235f6 commit 7812b50
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions homeassistant/components/powerwall/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

from tesla_powerwall import MeterType

from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, SensorEntity
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
)
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_ENERGY,
Expand All @@ -12,7 +16,6 @@
PERCENTAGE,
POWER_KILO_WATT,
)
import homeassistant.util.dt as dt_util

from .const import (
ATTR_FREQUENCY,
Expand Down Expand Up @@ -151,10 +154,9 @@ def extra_state_attributes(self):
class PowerWallEnergyDirectionSensor(PowerWallEntity, SensorEntity):
"""Representation of an Powerwall Direction Energy sensor."""

_attr_state_class = STATE_CLASS_MEASUREMENT
_attr_state_class = STATE_CLASS_TOTAL_INCREASING
_attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
_attr_device_class = DEVICE_CLASS_ENERGY
_attr_last_reset = dt_util.utc_from_timestamp(0)

def __init__(
self,
Expand Down

0 comments on commit 7812b50

Please sign in to comment.