1
mirror of https://github.com/home-assistant/core synced 2024-07-18 12:02:20 +02:00

Clean up deconz constants (#49754)

This commit is contained in:
tkdrob 2021-04-27 10:05:03 -04:00 committed by GitHub
parent 664075962f
commit 978d706b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -64,8 +64,7 @@ COVER_TYPES = DAMPERS + WINDOW_COVERS
FANS = ["Fan"]
# Locks
LOCKS = ["Door Lock", "ZHADoorLock"]
LOCK_TYPES = LOCKS
LOCK_TYPES = ["Door Lock", "ZHADoorLock"]
# Switches
POWER_PLUGS = ["On/Off light", "On/Off plug-in unit", "Smart plug"]
@ -74,4 +73,3 @@ SWITCH_TYPES = POWER_PLUGS + SIRENS
CONF_ANGLE = "angle"
CONF_GESTURE = "gesture"
CONF_XY = "xy"

View File

@ -15,6 +15,7 @@ from homeassistant.const import (
CONF_EVENT,
CONF_ID,
CONF_UNIQUE_ID,
CONF_XY,
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARMED_NIGHT,
@ -25,7 +26,7 @@ from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util import slugify
from .const import CONF_ANGLE, CONF_GESTURE, CONF_XY, LOGGER, NEW_SENSOR
from .const import CONF_ANGLE, CONF_GESTURE, LOGGER, NEW_SENSOR
from .deconz_device import DeconzBase
CONF_DECONZ_EVENT = "deconz_event"

View File

@ -3,7 +3,7 @@ from homeassistant.components.lock import DOMAIN, LockEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import LOCKS, NEW_LIGHT, NEW_SENSOR
from .const import LOCK_TYPES, NEW_LIGHT, NEW_SENSOR
from .deconz_device import DeconzDevice
from .gateway import get_gateway_from_config_entry
@ -20,7 +20,10 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
for light in lights:
if light.type in LOCKS and light.uniqueid not in gateway.entities[DOMAIN]:
if (
light.type in LOCK_TYPES
and light.uniqueid not in gateway.entities[DOMAIN]
):
entities.append(DeconzLock(light, gateway))
if entities:
@ -39,7 +42,10 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
for sensor in sensors:
if sensor.type in LOCKS and sensor.uniqueid not in gateway.entities[DOMAIN]:
if (
sensor.type in LOCK_TYPES
and sensor.uniqueid not in gateway.entities[DOMAIN]
):
entities.append(DeconzLock(sensor, gateway))
if entities: