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 homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_OCCUPANCY,
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
@ -97,7 +97,7 @@ class EcobeeBinarySensor(BinarySensorEntity):
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the class of this sensor, from DEVICE_CLASSES."""
|
||||
return DEVICE_CLASS_OCCUPANCY
|
||||
return BinarySensorDeviceClass.OCCUPANCY
|
||||
|
||||
async def async_update(self):
|
||||
"""Get the latest state of the sensor."""
|
||||
|
@ -3,11 +3,10 @@ from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant.components.humidifier import HumidifierEntity
|
||||
from homeassistant.components.humidifier import HumidifierDeviceClass, HumidifierEntity
|
||||
from homeassistant.components.humidifier.const import (
|
||||
DEFAULT_MAX_HUMIDITY,
|
||||
DEFAULT_MIN_HUMIDITY,
|
||||
DEVICE_CLASS_HUMIDIFIER,
|
||||
MODE_AUTO,
|
||||
SUPPORT_MODES,
|
||||
)
|
||||
@ -97,7 +96,7 @@ class EcobeeHumidifier(HumidifierEntity):
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the device class type."""
|
||||
return DEVICE_CLASS_HUMIDIFIER
|
||||
return HumidifierDeviceClass.HUMIDIFIER
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
|
@ -4,16 +4,12 @@ from __future__ import annotations
|
||||
from pyecobee.const import ECOBEE_STATE_CALIBRATING, ECOBEE_STATE_UNKNOWN
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
PERCENTAGE,
|
||||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
from homeassistant.const import PERCENTAGE, TEMP_FAHRENHEIT
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from .const import DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
|
||||
@ -23,15 +19,15 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
key="temperature",
|
||||
name="Temperature",
|
||||
native_unit_of_measurement=TEMP_FAHRENHEIT,
|
||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="humidity",
|
||||
name="Humidity",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
device_class=DEVICE_CLASS_HUMIDITY,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
device_class=SensorDeviceClass.HUMIDITY,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user