Use new enums in somfy (#62378)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
527d3a9e5b
commit
ff7a0dabb2
2 changed files with 6 additions and 7 deletions
|
@ -6,8 +6,6 @@ from pymfy.api.devices.category import Category
|
|||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
ATTR_TILT_POSITION,
|
||||
DEVICE_CLASS_BLIND,
|
||||
DEVICE_CLASS_SHUTTER,
|
||||
SUPPORT_CLOSE,
|
||||
SUPPORT_CLOSE_TILT,
|
||||
SUPPORT_OPEN,
|
||||
|
@ -16,6 +14,7 @@ from homeassistant.components.cover import (
|
|||
SUPPORT_SET_TILT_POSITION,
|
||||
SUPPORT_STOP,
|
||||
SUPPORT_STOP_TILT,
|
||||
CoverDeviceClass,
|
||||
CoverEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_OPTIMISTIC, STATE_CLOSED, STATE_OPEN
|
||||
|
@ -123,9 +122,9 @@ class SomfyCover(SomfyEntity, RestoreEntity, CoverEntity):
|
|||
def device_class(self):
|
||||
"""Return the device class."""
|
||||
if self.categories & BLIND_DEVICE_CATEGORIES:
|
||||
return DEVICE_CLASS_BLIND
|
||||
return CoverDeviceClass.BLIND
|
||||
if self.categories & SHUTTER_DEVICE_CATEGORIES:
|
||||
return DEVICE_CLASS_SHUTTER
|
||||
return CoverDeviceClass.SHUTTER
|
||||
return None
|
||||
|
||||
@property
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
from pymfy.api.devices.category import Category
|
||||
from pymfy.api.devices.thermostat import Thermostat
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||
from homeassistant.const import PERCENTAGE
|
||||
|
||||
from .const import COORDINATOR, DOMAIN
|
||||
from .entity import SomfyEntity
|
||||
|
@ -29,7 +29,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
class SomfyThermostatBatterySensor(SomfyEntity, SensorEntity):
|
||||
"""Representation of a Somfy thermostat battery."""
|
||||
|
||||
_attr_device_class = DEVICE_CLASS_BATTERY
|
||||
_attr_device_class = SensorDeviceClass.BATTERY
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
|
||||
def __init__(self, coordinator, device_id):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue