mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Remove last_reset
attribute and set state class to total_increasing
for powerwall energy sensors (#54808)
This commit is contained in:
parent
3e235f6e70
commit
7812b50572
@ -3,7 +3,11 @@ import logging
|
|||||||
|
|
||||||
from tesla_powerwall import MeterType
|
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 (
|
from homeassistant.const import (
|
||||||
DEVICE_CLASS_BATTERY,
|
DEVICE_CLASS_BATTERY,
|
||||||
DEVICE_CLASS_ENERGY,
|
DEVICE_CLASS_ENERGY,
|
||||||
@ -12,7 +16,6 @@ from homeassistant.const import (
|
|||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_KILO_WATT,
|
POWER_KILO_WATT,
|
||||||
)
|
)
|
||||||
import homeassistant.util.dt as dt_util
|
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_FREQUENCY,
|
ATTR_FREQUENCY,
|
||||||
@ -151,10 +154,9 @@ class PowerWallEnergySensor(PowerWallEntity, SensorEntity):
|
|||||||
class PowerWallEnergyDirectionSensor(PowerWallEntity, SensorEntity):
|
class PowerWallEnergyDirectionSensor(PowerWallEntity, SensorEntity):
|
||||||
"""Representation of an Powerwall Direction Energy sensor."""
|
"""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_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
|
||||||
_attr_device_class = DEVICE_CLASS_ENERGY
|
_attr_device_class = DEVICE_CLASS_ENERGY
|
||||||
_attr_last_reset = dt_util.utc_from_timestamp(0)
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user