Use enums in rachio (#62056)

This commit is contained in:
Robert Hillis 2021-12-16 17:26:53 -05:00 committed by GitHub
parent 16e152b797
commit da60680b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,7 @@ from abc import abstractmethod
import logging import logging
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY, BinarySensorDeviceClass,
DEVICE_CLASS_MOISTURE,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.core import callback from homeassistant.core import callback
@ -89,9 +88,9 @@ class RachioControllerOnlineBinarySensor(RachioControllerBinarySensor):
return f"{self._controller.controller_id}-online" return f"{self._controller.controller_id}-online"
@property @property
def device_class(self) -> str: def device_class(self) -> BinarySensorDeviceClass:
"""Return the class of this device, from component DEVICE_CLASSES.""" """Return the class of this device, from BinarySensorDeviceClass."""
return DEVICE_CLASS_CONNECTIVITY return BinarySensorDeviceClass.CONNECTIVITY
@property @property
def icon(self) -> str: def icon(self) -> str:
@ -138,9 +137,9 @@ class RachioRainSensor(RachioControllerBinarySensor):
return f"{self._controller.controller_id}-rain_sensor" return f"{self._controller.controller_id}-rain_sensor"
@property @property
def device_class(self) -> str: def device_class(self) -> BinarySensorDeviceClass:
"""Return the class of this device.""" """Return the class of this device."""
return DEVICE_CLASS_MOISTURE return BinarySensorDeviceClass.MOISTURE
@property @property
def icon(self) -> str: def icon(self) -> str: