Use isinstance to verify class in deCONZ integration (#56794)
* Don't enable any variants of the daylight sensor entities by default * Use isinstance rather than doing ZHATYPE compare * Accidentally removed an import
This commit is contained in:
parent
0463007050
commit
f224ab6d67
13 changed files with 95 additions and 86 deletions
|
@ -1,4 +1,7 @@
|
|||
"""Support for deCONZ covers."""
|
||||
|
||||
from pydeconz.light import Cover
|
||||
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
ATTR_TILT_POSITION,
|
||||
|
@ -18,20 +21,14 @@ from homeassistant.components.cover import (
|
|||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
from .const import (
|
||||
COVER_TYPES,
|
||||
LEVEL_CONTROLLABLE_OUTPUT,
|
||||
NEW_LIGHT,
|
||||
WINDOW_COVERING_CONTROLLER,
|
||||
WINDOW_COVERING_DEVICE,
|
||||
)
|
||||
from .const import NEW_LIGHT
|
||||
from .deconz_device import DeconzDevice
|
||||
from .gateway import get_gateway_from_config_entry
|
||||
|
||||
DEVICE_CLASS = {
|
||||
LEVEL_CONTROLLABLE_OUTPUT: DEVICE_CLASS_DAMPER,
|
||||
WINDOW_COVERING_CONTROLLER: DEVICE_CLASS_SHADE,
|
||||
WINDOW_COVERING_DEVICE: DEVICE_CLASS_SHADE,
|
||||
"Level controllable output": DEVICE_CLASS_DAMPER,
|
||||
"Window covering controller": DEVICE_CLASS_SHADE,
|
||||
"Window covering device": DEVICE_CLASS_SHADE,
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +44,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
|
||||
for light in lights:
|
||||
if (
|
||||
light.type in COVER_TYPES
|
||||
isinstance(light, Cover)
|
||||
and light.unique_id not in gateway.entities[DOMAIN]
|
||||
):
|
||||
entities.append(DeconzCover(light, gateway))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue