mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use new enums in myq (#61933)
This commit is contained in:
parent
f9a310ea49
commit
6b13dc7285
@ -1,9 +1,9 @@
|
|||||||
"""Support for MyQ gateways."""
|
"""Support for MyQ gateways."""
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_CONNECTIVITY,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
|
|
||||||
from . import MyQEntity
|
from . import MyQEntity
|
||||||
from .const import DOMAIN, MYQ_COORDINATOR, MYQ_GATEWAY
|
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):
|
class MyQBinarySensorEntity(MyQEntity, BinarySensorEntity):
|
||||||
"""Representation of a MyQ gateway."""
|
"""Representation of a MyQ gateway."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_CONNECTIVITY
|
_attr_device_class = BinarySensorDeviceClass.CONNECTIVITY
|
||||||
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
|
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -3,10 +3,9 @@ from pymyq.const import DEVICE_TYPE_GATE as MYQ_DEVICE_TYPE_GATE
|
|||||||
from pymyq.errors import MyQError
|
from pymyq.errors import MyQError
|
||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
DEVICE_CLASS_GARAGE,
|
|
||||||
DEVICE_CLASS_GATE,
|
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
|
CoverDeviceClass,
|
||||||
CoverEntity,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING
|
from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING
|
||||||
@ -37,9 +36,9 @@ class MyQCover(MyQEntity, CoverEntity):
|
|||||||
super().__init__(coordinator, device)
|
super().__init__(coordinator, device)
|
||||||
self._device = device
|
self._device = device
|
||||||
if device.device_type == MYQ_DEVICE_TYPE_GATE:
|
if device.device_type == MYQ_DEVICE_TYPE_GATE:
|
||||||
self._attr_device_class = DEVICE_CLASS_GATE
|
self._attr_device_class = CoverDeviceClass.GATE
|
||||||
else:
|
else:
|
||||||
self._attr_device_class = DEVICE_CLASS_GARAGE
|
self._attr_device_class = CoverDeviceClass.GARAGE
|
||||||
self._attr_unique_id = device.device_id
|
self._attr_unique_id = device.device_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user