Use enums in totalconnect (#62022)
This commit is contained in:
parent
fcda72a337
commit
09892a5c55
1 changed files with 7 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue