Use enums in risco (#62042)

This commit is contained in:
Robert Hillis 2021-12-16 08:41:20 -05:00 committed by GitHub
parent 0dc5ae6dca
commit 7506b12277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -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)

View File

@ -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