deCONZ - Support creating battery sensor when reported (#27538)

This commit is contained in:
Robert Svensson
2019-11-01 22:31:22 +01:00
committed by GitHub
parent 62b09580c4
commit 557e585e56
4 changed files with 90 additions and 8 deletions

View File

@@ -26,13 +26,13 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
entity_handler = DeconzEntityHandler(gateway)
@callback
def async_add_sensor(sensors):
def async_add_sensor(sensors, new=True):
"""Add binary sensor from deCONZ."""
entities = []
for sensor in sensors:
if sensor.BINARY:
if new and sensor.BINARY:
new_sensor = DeconzBinarySensor(sensor, gateway)
entity_handler.add_entity(new_sensor)
entities.append(new_sensor)