Track entity sources (#37258)
Co-authored-by: David Mulcahey <david.mulcahey@me.com>
This commit is contained in:
parent
24a16ff8fe
commit
3dc79aa60a
15 changed files with 379 additions and 154 deletions
|
@ -27,9 +27,16 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
|
||||
# Get Dyson Devices from parent component
|
||||
device_ids = [device.unique_id for device in hass.data[DYSON_AIQ_DEVICES]]
|
||||
new_entities = []
|
||||
for device in hass.data[DYSON_DEVICES]:
|
||||
print(device.serial)
|
||||
if isinstance(device, DysonPureCool) and device.serial not in device_ids:
|
||||
hass.data[DYSON_AIQ_DEVICES].append(DysonAirSensor(device))
|
||||
new_entities.append(DysonAirSensor(device))
|
||||
|
||||
if not new_entities:
|
||||
return
|
||||
|
||||
hass.data[DYSON_AIQ_DEVICES].extend(new_entities)
|
||||
add_entities(hass.data[DYSON_AIQ_DEVICES])
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue