Use new enums in hunterdouglas_powerview (#61777)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-14 13:07:59 +01:00 committed by GitHub
parent 237a8a8331
commit bcc9251517
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View file

@ -14,11 +14,11 @@ import async_timeout
from homeassistant.components.cover import (
ATTR_POSITION,
DEVICE_CLASS_SHADE,
SUPPORT_CLOSE,
SUPPORT_OPEN,
SUPPORT_SET_POSITION,
SUPPORT_STOP,
CoverDeviceClass,
CoverEntity,
)
from homeassistant.core import callback
@ -145,7 +145,7 @@ class PowerViewShade(ShadeEntity, CoverEntity):
@property
def device_class(self):
"""Return device class."""
return DEVICE_CLASS_SHADE
return CoverDeviceClass.SHADE
@property
def name(self):

View file

@ -1,13 +1,10 @@
"""Support for hunterdouglass_powerview sensors."""
from aiopvapi.resources.shade import factory as PvShade
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
ENTITY_CATEGORY_DIAGNOSTIC,
PERCENTAGE,
)
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import PERCENTAGE
from homeassistant.core import callback
from homeassistant.helpers.entity import EntityCategory
from .const import (
COORDINATOR,
@ -53,7 +50,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
class PowerViewShadeBatterySensor(ShadeEntity, SensorEntity):
"""Representation of an shade battery charge sensor."""
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
_attr_entity_category = EntityCategory.DIAGNOSTIC
@property
def native_unit_of_measurement(self):
@ -68,7 +65,7 @@ class PowerViewShadeBatterySensor(ShadeEntity, SensorEntity):
@property
def device_class(self):
"""Shade battery Class."""
return DEVICE_CLASS_BATTERY
return SensorDeviceClass.BATTERY
@property
def unique_id(self):