deCONZ - Revert from using disabled_by when setting options (#31446)

* Revert from using disabled_by when setting options

* Remove signalling for changed options

* Evaluate allow group option earlier when adding a group
This commit is contained in:
Robert Svensson
2020-02-05 01:37:01 +01:00
committed by GitHub
parent 3801d5adf4
commit fce9697591
6 changed files with 30 additions and 88 deletions

View File

@@ -8,7 +8,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import ATTR_DARK, ATTR_ON, NEW_SENSOR
from .deconz_device import DeconzDevice
from .gateway import DeconzEntityHandler, get_gateway_from_config_entry
from .gateway import get_gateway_from_config_entry
ATTR_ORIENTATION = "orientation"
ATTR_TILTANGLE = "tiltangle"
@@ -23,8 +23,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the deCONZ binary sensor."""
gateway = get_gateway_from_config_entry(hass, config_entry)
entity_handler = DeconzEntityHandler(gateway)
@callback
def async_add_sensor(sensors, new=True):
"""Add binary sensor from deCONZ."""
@@ -32,10 +30,15 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
for sensor in sensors:
if new and sensor.BINARY:
new_sensor = DeconzBinarySensor(sensor, gateway)
entity_handler.add_entity(new_sensor)
entities.append(new_sensor)
if (
new
and sensor.BINARY
and (
gateway.option_allow_clip_sensor
or not sensor.type.startswith("CLIP")
)
):
entities.append(DeconzBinarySensor(sensor, gateway))
async_add_entities(entities, True)