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."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.helpers import entity_platform
@ -72,8 +72,8 @@ class RiscoBinarySensor(BinarySensorEntity, RiscoEntity):
@property
def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES."""
return DEVICE_CLASS_MOTION
"""Return the class of this sensor, from BinarySensorDeviceClass."""
return BinarySensorDeviceClass.MOTION
async def _bypass(self, bypass):
alarm = await self._risco.bypass_zone(self._zone_id, bypass)

View file

@ -1,7 +1,6 @@
"""Sensor for Risco Events."""
from homeassistant.components.binary_sensor import DOMAIN as BS_DOMAIN
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN, EVENTS_COORDINATOR
@ -116,4 +115,4 @@ class RiscoSensor(CoordinatorEntity, SensorEntity):
@property
def device_class(self):
"""Device class of sensor."""
return DEVICE_CLASS_TIMESTAMP
return SensorDeviceClass.TIMESTAMP