mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use enums in risco (#62042)
This commit is contained in:
parent
0dc5ae6dca
commit
7506b12277
@ -1,6 +1,6 @@
|
|||||||
"""Support for Risco alarm zones."""
|
"""Support for Risco alarm zones."""
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_MOTION,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
@ -72,8 +72,8 @@ class RiscoBinarySensor(BinarySensorEntity, RiscoEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of this sensor, from DEVICE_CLASSES."""
|
"""Return the class of this sensor, from BinarySensorDeviceClass."""
|
||||||
return DEVICE_CLASS_MOTION
|
return BinarySensorDeviceClass.MOTION
|
||||||
|
|
||||||
async def _bypass(self, bypass):
|
async def _bypass(self, bypass):
|
||||||
alarm = await self._risco.bypass_zone(self._zone_id, bypass)
|
alarm = await self._risco.bypass_zone(self._zone_id, bypass)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Sensor for Risco Events."""
|
"""Sensor for Risco Events."""
|
||||||
from homeassistant.components.binary_sensor import DOMAIN as BS_DOMAIN
|
from homeassistant.components.binary_sensor import DOMAIN as BS_DOMAIN
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
|
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import DOMAIN, EVENTS_COORDINATOR
|
from .const import DOMAIN, EVENTS_COORDINATOR
|
||||||
@ -116,4 +115,4 @@ class RiscoSensor(CoordinatorEntity, SensorEntity):
|
|||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Device class of sensor."""
|
"""Device class of sensor."""
|
||||||
return DEVICE_CLASS_TIMESTAMP
|
return SensorDeviceClass.TIMESTAMP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user