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."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_DOOR,
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_SAFETY,
DEVICE_CLASS_SMOKE,
BinarySensorDeviceClass,
BinarySensorEntity,
)
@ -65,17 +61,17 @@ class TotalConnectBinarySensor(BinarySensorEntity):
@property
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():
return DEVICE_CLASS_DOOR
return BinarySensorDeviceClass.DOOR
if self._zone.is_type_fire():
return DEVICE_CLASS_SMOKE
return BinarySensorDeviceClass.SMOKE
if self._zone.is_type_carbon_monoxide():
return DEVICE_CLASS_GAS
return BinarySensorDeviceClass.GAS
if self._zone.is_type_motion():
return DEVICE_CLASS_MOTION
return BinarySensorDeviceClass.MOTION
if self._zone.is_type_medical():
return DEVICE_CLASS_SAFETY
return BinarySensorDeviceClass.SAFETY
return None
@property