mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use enums in totalconnect (#62022)
This commit is contained in:
parent
fcda72a337
commit
09892a5c55
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user