Use new enums in myq (#61933)

This commit is contained in:
epenet 2021-12-15 20:44:27 +01:00 committed by GitHub
parent f9a310ea49
commit 6b13dc7285
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View file

@ -1,9 +1,9 @@
"""Support for MyQ gateways."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC
from homeassistant.helpers.entity import EntityCategory
from . import MyQEntity
from .const import DOMAIN, MYQ_COORDINATOR, MYQ_GATEWAY
@ -26,8 +26,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class MyQBinarySensorEntity(MyQEntity, BinarySensorEntity):
"""Representation of a MyQ gateway."""
_attr_device_class = DEVICE_CLASS_CONNECTIVITY
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
_attr_device_class = BinarySensorDeviceClass.CONNECTIVITY
_attr_entity_category = EntityCategory.DIAGNOSTIC
@property
def name(self):

View file

@ -3,10 +3,9 @@ from pymyq.const import DEVICE_TYPE_GATE as MYQ_DEVICE_TYPE_GATE
from pymyq.errors import MyQError
from homeassistant.components.cover import (
DEVICE_CLASS_GARAGE,
DEVICE_CLASS_GATE,
SUPPORT_CLOSE,
SUPPORT_OPEN,
CoverDeviceClass,
CoverEntity,
)
from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING
@ -37,9 +36,9 @@ class MyQCover(MyQEntity, CoverEntity):
super().__init__(coordinator, device)
self._device = device
if device.device_type == MYQ_DEVICE_TYPE_GATE:
self._attr_device_class = DEVICE_CLASS_GATE
self._attr_device_class = CoverDeviceClass.GATE
else:
self._attr_device_class = DEVICE_CLASS_GARAGE
self._attr_device_class = CoverDeviceClass.GARAGE
self._attr_unique_id = device.device_id
@property