Rfxtrx,STATE_CLASS_TOTAL_INCREASING (#54776)

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
This commit is contained in:
Daniel Hjelseth Høyer 2021-08-18 00:46:48 +02:00 committed by GitHub
parent 3a78f1fce6
commit 6da83b90f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ from homeassistant.components.sensor import (
DEVICE_CLASS_SIGNAL_STRENGTH, DEVICE_CLASS_SIGNAL_STRENGTH,
DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TEMPERATURE,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
) )
@ -38,7 +39,6 @@ from homeassistant.const import (
UV_INDEX, UV_INDEX,
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.util import dt
from . import ( from . import (
CONF_DATA_BITS, CONF_DATA_BITS,
@ -145,8 +145,7 @@ SENSOR_TYPES = (
RfxtrxSensorEntityDescription( RfxtrxSensorEntityDescription(
key="Total usage", key="Total usage",
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL_INCREASING,
last_reset=dt.utc_from_timestamp(0),
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
), ),
RfxtrxSensorEntityDescription( RfxtrxSensorEntityDescription(
@ -173,14 +172,12 @@ SENSOR_TYPES = (
), ),
RfxtrxSensorEntityDescription( RfxtrxSensorEntityDescription(
key="Count", key="Count",
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL_INCREASING,
last_reset=dt.utc_from_timestamp(0),
native_unit_of_measurement="count", native_unit_of_measurement="count",
), ),
RfxtrxSensorEntityDescription( RfxtrxSensorEntityDescription(
key="Counter value", key="Counter value",
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL_INCREASING,
last_reset=dt.utc_from_timestamp(0),
native_unit_of_measurement="count", native_unit_of_measurement="count",
), ),
RfxtrxSensorEntityDescription( RfxtrxSensorEntityDescription(