mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
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
@ -7,12 +7,9 @@ import requests
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_MOTION,
|
|
||||||
DEVICE_CLASS_OPENING,
|
|
||||||
DEVICE_CLASS_SAFETY,
|
|
||||||
DEVICE_CLASS_SMOKE,
|
|
||||||
DEVICE_CLASSES,
|
DEVICE_CLASSES,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
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):
|
def get_opening_type(zone):
|
||||||
"""Return the result of the type guessing from name."""
|
"""Return the result of the type guessing from name."""
|
||||||
if "MOTION" in zone["name"]:
|
if "MOTION" in zone["name"]:
|
||||||
return DEVICE_CLASS_MOTION
|
return BinarySensorDeviceClass.MOTION
|
||||||
if "KEY" in zone["name"]:
|
if "KEY" in zone["name"]:
|
||||||
return DEVICE_CLASS_SAFETY
|
return BinarySensorDeviceClass.SAFETY
|
||||||
if "SMOKE" in zone["name"]:
|
if "SMOKE" in zone["name"]:
|
||||||
return DEVICE_CLASS_SMOKE
|
return BinarySensorDeviceClass.SMOKE
|
||||||
if "WATER" in zone["name"]:
|
if "WATER" in zone["name"]:
|
||||||
return "water"
|
return "water"
|
||||||
return DEVICE_CLASS_OPENING
|
return BinarySensorDeviceClass.OPENING
|
||||||
|
|
||||||
|
|
||||||
class Concord232ZoneSensor(BinarySensorEntity):
|
class Concord232ZoneSensor(BinarySensorEntity):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user