mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Update deCONZ to use new state classes (#54729)
This commit is contained in:
parent
789e6555cc
commit
4c5d5a8f5a
@ -17,6 +17,7 @@ from pydeconz.sensor import (
|
|||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
STATE_CLASS_MEASUREMENT,
|
STATE_CLASS_MEASUREMENT,
|
||||||
|
STATE_CLASS_TOTAL_INCREASING,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@ -41,7 +42,6 @@ from homeassistant.helpers.dispatcher import (
|
|||||||
async_dispatcher_connect,
|
async_dispatcher_connect,
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
from homeassistant.util import dt as dt_util
|
|
||||||
|
|
||||||
from .const import ATTR_DARK, ATTR_ON, NEW_SENSOR
|
from .const import ATTR_DARK, ATTR_ON, NEW_SENSOR
|
||||||
from .deconz_device import DeconzDevice
|
from .deconz_device import DeconzDevice
|
||||||
@ -68,7 +68,7 @@ ICON = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
STATE_CLASS = {
|
STATE_CLASS = {
|
||||||
Consumption: STATE_CLASS_MEASUREMENT,
|
Consumption: STATE_CLASS_TOTAL_INCREASING,
|
||||||
Humidity: STATE_CLASS_MEASUREMENT,
|
Humidity: STATE_CLASS_MEASUREMENT,
|
||||||
Pressure: STATE_CLASS_MEASUREMENT,
|
Pressure: STATE_CLASS_MEASUREMENT,
|
||||||
Temperature: STATE_CLASS_MEASUREMENT,
|
Temperature: STATE_CLASS_MEASUREMENT,
|
||||||
@ -164,9 +164,6 @@ class DeconzSensor(DeconzDevice, SensorEntity):
|
|||||||
type(self._device)
|
type(self._device)
|
||||||
)
|
)
|
||||||
|
|
||||||
if device.type in Consumption.ZHATYPE:
|
|
||||||
self._attr_last_reset = dt_util.utc_from_timestamp(0)
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_update_callback(self, force_update=False):
|
def async_update_callback(self, force_update=False):
|
||||||
"""Update the sensor's state."""
|
"""Update the sensor's state."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user