mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 08:07:45 +00:00
Use new DeviceClass and StateClass enums in ecobee (#61372)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
f7bdbd9fdd
commit
728f511627
@ -2,7 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_OCCUPANCY,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
@ -97,7 +97,7 @@ class EcobeeBinarySensor(BinarySensorEntity):
|
|||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of this sensor, from DEVICE_CLASSES."""
|
"""Return the class of this sensor, from DEVICE_CLASSES."""
|
||||||
return DEVICE_CLASS_OCCUPANCY
|
return BinarySensorDeviceClass.OCCUPANCY
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Get the latest state of the sensor."""
|
"""Get the latest state of the sensor."""
|
||||||
|
@ -3,11 +3,10 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from homeassistant.components.humidifier import HumidifierEntity
|
from homeassistant.components.humidifier import HumidifierDeviceClass, HumidifierEntity
|
||||||
from homeassistant.components.humidifier.const import (
|
from homeassistant.components.humidifier.const import (
|
||||||
DEFAULT_MAX_HUMIDITY,
|
DEFAULT_MAX_HUMIDITY,
|
||||||
DEFAULT_MIN_HUMIDITY,
|
DEFAULT_MIN_HUMIDITY,
|
||||||
DEVICE_CLASS_HUMIDIFIER,
|
|
||||||
MODE_AUTO,
|
MODE_AUTO,
|
||||||
SUPPORT_MODES,
|
SUPPORT_MODES,
|
||||||
)
|
)
|
||||||
@ -97,7 +96,7 @@ class EcobeeHumidifier(HumidifierEntity):
|
|||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the device class type."""
|
"""Return the device class type."""
|
||||||
return DEVICE_CLASS_HUMIDIFIER
|
return HumidifierDeviceClass.HUMIDIFIER
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
@ -4,16 +4,12 @@ from __future__ import annotations
|
|||||||
from pyecobee.const import ECOBEE_STATE_CALIBRATING, ECOBEE_STATE_UNKNOWN
|
from pyecobee.const import ECOBEE_STATE_CALIBRATING, ECOBEE_STATE_UNKNOWN
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
STATE_CLASS_MEASUREMENT,
|
SensorDeviceClass,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import PERCENTAGE, TEMP_FAHRENHEIT
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
PERCENTAGE,
|
|
||||||
TEMP_FAHRENHEIT,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
|
||||||
from .const import DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
|
from .const import DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
|
||||||
@ -23,15 +19,15 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
key="temperature",
|
key="temperature",
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
native_unit_of_measurement=TEMP_FAHRENHEIT,
|
native_unit_of_measurement=TEMP_FAHRENHEIT,
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="humidity",
|
key="humidity",
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user