Use enums in totalconnect (#62022)

This commit is contained in:
Robert Hillis 2021-12-16 07:08:37 -05:00 committed by GitHub
parent fcda72a337
commit 09892a5c55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,6 @@
"""Interfaces with TotalConnect sensors.""" """Interfaces with TotalConnect sensors."""
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_DOOR, BinarySensorDeviceClass,
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_SAFETY,
DEVICE_CLASS_SMOKE,
BinarySensorEntity, BinarySensorEntity,
) )
@ -65,17 +61,17 @@ class TotalConnectBinarySensor(BinarySensorEntity):
@property @property
def device_class(self): def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES.""" """Return the class of this device, from BinarySensorDeviceClass."""
if self._zone.is_type_security(): if self._zone.is_type_security():
return DEVICE_CLASS_DOOR return BinarySensorDeviceClass.DOOR
if self._zone.is_type_fire(): if self._zone.is_type_fire():
return DEVICE_CLASS_SMOKE return BinarySensorDeviceClass.SMOKE
if self._zone.is_type_carbon_monoxide(): if self._zone.is_type_carbon_monoxide():
return DEVICE_CLASS_GAS return BinarySensorDeviceClass.GAS
if self._zone.is_type_motion(): if self._zone.is_type_motion():
return DEVICE_CLASS_MOTION return BinarySensorDeviceClass.MOTION
if self._zone.is_type_medical(): if self._zone.is_type_medical():
return DEVICE_CLASS_SAFETY return BinarySensorDeviceClass.SAFETY
return None return None
@property @property