Use new BinarySensorDeviceClass enum in concord232 (#61335)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
59878968b2
commit
8df0bc9d57
1 changed files with 5 additions and 8 deletions
|
@ -7,12 +7,9 @@ import requests
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_MOTION,
|
||||
DEVICE_CLASS_OPENING,
|
||||
DEVICE_CLASS_SAFETY,
|
||||
DEVICE_CLASS_SMOKE,
|
||||
DEVICE_CLASSES,
|
||||
PLATFORM_SCHEMA,
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
|
@ -89,14 +86,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
def get_opening_type(zone):
|
||||
"""Return the result of the type guessing from name."""
|
||||
if "MOTION" in zone["name"]:
|
||||
return DEVICE_CLASS_MOTION
|
||||
return BinarySensorDeviceClass.MOTION
|
||||
if "KEY" in zone["name"]:
|
||||
return DEVICE_CLASS_SAFETY
|
||||
return BinarySensorDeviceClass.SAFETY
|
||||
if "SMOKE" in zone["name"]:
|
||||
return DEVICE_CLASS_SMOKE
|
||||
return BinarySensorDeviceClass.SMOKE
|
||||
if "WATER" in zone["name"]:
|
||||
return "water"
|
||||
return DEVICE_CLASS_OPENING
|
||||
return BinarySensorDeviceClass.OPENING
|
||||
|
||||
|
||||
class Concord232ZoneSensor(BinarySensorEntity):
|
||||
|
|
Loading…
Add table
Reference in a new issue