Simplify setup of deCONZ platforms (#72453)

This commit is contained in:
Robert Svensson 2022-05-25 05:48:09 +02:00 committed by GitHub
parent fbeaf200e4
commit e60b247b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 130 additions and 134 deletions

View file

@ -43,14 +43,10 @@ async def async_setup_entry(
cover = gateway.api.lights.covers[cover_id]
async_add_entities([DeconzCover(cover, gateway)])
config_entry.async_on_unload(
gateway.api.lights.covers.subscribe(
gateway.evaluate_add_device(async_add_cover),
EventType.ADDED,
)
gateway.register_platform_add_device_callback(
async_add_cover,
gateway.api.lights.covers,
)
for cover_id in gateway.api.lights.covers:
async_add_cover(EventType.ADDED, cover_id)
class DeconzCover(DeconzDevice, CoverEntity):