Refactor binary sensor creation in Risco integration (#82043)

pull/82045/head
On Freund 2022-11-13 19:53:54 +02:00 committed by GitHub
parent fe7ffe9519
commit 52a8f4df82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 9 deletions

View File

@ -28,16 +28,13 @@ async def async_setup_entry(
if is_local(config_entry):
local_data: LocalData = hass.data[DOMAIN][config_entry.entry_id]
async_add_entities(
RiscoLocalBinarySensor(local_data.system.id, zone_id, zone)
for zone_id, zone in local_data.system.zones.items()
)
async_add_entities(
RiscoLocalAlarmedBinarySensor(local_data.system.id, zone_id, zone)
for zone_id, zone in local_data.system.zones.items()
)
async_add_entities(
RiscoLocalArmedBinarySensor(local_data.system.id, zone_id, zone)
entity
for zone_id, zone in local_data.system.zones.items()
for entity in (
RiscoLocalBinarySensor(local_data.system.id, zone_id, zone),
RiscoLocalAlarmedBinarySensor(local_data.system.id, zone_id, zone),
RiscoLocalArmedBinarySensor(local_data.system.id, zone_id, zone),
)
)
else:
coordinator: RiscoDataUpdateCoordinator = hass.data[DOMAIN][