From 09892a5c55385d1e026310b427579cb3f3e6380f Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Thu, 16 Dec 2021 07:08:37 -0500 Subject: [PATCH] Use enums in totalconnect (#62022) --- .../components/totalconnect/binary_sensor.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/totalconnect/binary_sensor.py b/homeassistant/components/totalconnect/binary_sensor.py index e37482cf1e1..d7b7301fd69 100644 --- a/homeassistant/components/totalconnect/binary_sensor.py +++ b/homeassistant/components/totalconnect/binary_sensor.py @@ -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