Use new DeviceClass enum in home_connect (#61759)
Co-authored-by: epenet <epenet@users.noreply.github.com>pull/61823/head
parent
67ddfcb218
commit
6bf41325ca
|
@ -7,12 +7,12 @@ import homeconnect
|
||||||
from homeconnect.api import HomeConnectError
|
from homeconnect.api import HomeConnectError
|
||||||
|
|
||||||
from homeassistant import config_entries, core
|
from homeassistant import config_entries, core
|
||||||
|
from homeassistant.components.sensor import SensorDeviceClass
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_ICON,
|
ATTR_ICON,
|
||||||
CONF_DEVICE,
|
CONF_DEVICE,
|
||||||
CONF_ENTITIES,
|
CONF_ENTITIES,
|
||||||
DEVICE_CLASS_TIMESTAMP,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TIME_SECONDS,
|
TIME_SECONDS,
|
||||||
)
|
)
|
||||||
|
@ -159,7 +159,7 @@ class DeviceWithPrograms(HomeConnectDevice):
|
||||||
device.
|
device.
|
||||||
"""
|
"""
|
||||||
sensors = {
|
sensors = {
|
||||||
"Remaining Program Time": (None, None, DEVICE_CLASS_TIMESTAMP, 1),
|
"Remaining Program Time": (None, None, SensorDeviceClass.TIMESTAMP, 1),
|
||||||
"Duration": (TIME_SECONDS, "mdi:update", None, 1),
|
"Duration": (TIME_SECONDS, "mdi:update", None, 1),
|
||||||
"Program Progress": (PERCENTAGE, "mdi:progress-clock", None, 1),
|
"Program Progress": (PERCENTAGE, "mdi:progress-clock", None, 1),
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.const import CONF_ENTITIES, DEVICE_CLASS_TIMESTAMP
|
from homeassistant.const import CONF_ENTITIES
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from .const import ATTR_VALUE, BSH_OPERATION_STATE, DOMAIN
|
from .const import ATTR_VALUE, BSH_OPERATION_STATE, DOMAIN
|
||||||
|
@ -57,7 +57,7 @@ class HomeConnectSensor(HomeConnectEntity, SensorEntity):
|
||||||
if self._key not in status:
|
if self._key not in status:
|
||||||
self._state = None
|
self._state = None
|
||||||
else:
|
else:
|
||||||
if self.device_class == DEVICE_CLASS_TIMESTAMP:
|
if self.device_class == SensorDeviceClass.TIMESTAMP:
|
||||||
if ATTR_VALUE not in status[self._key]:
|
if ATTR_VALUE not in status[self._key]:
|
||||||
self._state = None
|
self._state = None
|
||||||
elif (
|
elif (
|
||||||
|
|
Loading…
Reference in New Issue