Address late fritzbox coordinator runtime device discover review comments (#104267)
replace list comprehension by generator expressionpull/104660/head
parent
ce497dd7ed
commit
f69045fb64
|
@ -75,12 +75,10 @@ async def async_setup_entry(
|
|||
if not coordinator.new_devices:
|
||||
return
|
||||
async_add_entities(
|
||||
[
|
||||
FritzboxBinarySensor(coordinator, ain, description)
|
||||
for ain in coordinator.new_devices
|
||||
for description in BINARY_SENSOR_TYPES
|
||||
if description.suitable(coordinator.data.devices[ain])
|
||||
]
|
||||
)
|
||||
|
||||
entry.async_on_unload(coordinator.async_add_listener(_add_entities))
|
||||
|
|
|
@ -24,7 +24,7 @@ async def async_setup_entry(
|
|||
if not coordinator.new_templates:
|
||||
return
|
||||
async_add_entities(
|
||||
[FritzBoxTemplate(coordinator, ain) for ain in coordinator.new_templates]
|
||||
FritzBoxTemplate(coordinator, ain) for ain in coordinator.new_templates
|
||||
)
|
||||
|
||||
entry.async_on_unload(coordinator.async_add_listener(_add_entities))
|
||||
|
|
|
@ -57,11 +57,9 @@ async def async_setup_entry(
|
|||
if not coordinator.new_devices:
|
||||
return
|
||||
async_add_entities(
|
||||
[
|
||||
FritzboxThermostat(coordinator, ain)
|
||||
for ain in coordinator.new_devices
|
||||
if coordinator.data.devices[ain].has_thermostat
|
||||
]
|
||||
)
|
||||
|
||||
entry.async_on_unload(coordinator.async_add_listener(_add_entities))
|
||||
|
|
|
@ -29,11 +29,9 @@ async def async_setup_entry(
|
|||
if not coordinator.new_devices:
|
||||
return
|
||||
async_add_entities(
|
||||
[
|
||||
FritzboxCover(coordinator, ain)
|
||||
for ain in coordinator.new_devices
|
||||
if coordinator.data.devices[ain].has_blind
|
||||
]
|
||||
)
|
||||
|
||||
entry.async_on_unload(coordinator.async_add_listener(_add_entities))
|
||||
|
|
|
@ -35,7 +35,6 @@ async def async_setup_entry(
|
|||
if not coordinator.new_devices:
|
||||
return
|
||||
async_add_entities(
|
||||
[
|
||||
FritzboxLight(
|
||||
coordinator,
|
||||
ain,
|
||||
|
@ -44,7 +43,6 @@ async def async_setup_entry(
|
|||
)
|
||||
for ain in coordinator.new_devices
|
||||
if (device := coordinator.data.devices[ain]).has_lightbulb
|
||||
]
|
||||
)
|
||||
|
||||
entry.async_on_unload(coordinator.async_add_listener(_add_entities))
|
||||
|
|
|
@ -220,12 +220,10 @@ async def async_setup_entry(
|
|||
if not coordinator.new_devices:
|
||||
return
|
||||
async_add_entities(
|
||||
[
|
||||
FritzBoxSensor(coordinator, ain, description)
|
||||
for ain in coordinator.new_devices
|
||||
for description in SENSOR_TYPES
|
||||
if description.suitable(coordinator.data.devices[ain])
|
||||
]
|
||||
)
|
||||
|
||||
entry.async_on_unload(coordinator.async_add_listener(_add_entities))
|
||||
|
|
|
@ -24,11 +24,9 @@ async def async_setup_entry(
|
|||
if not coordinator.new_devices:
|
||||
return
|
||||
async_add_entities(
|
||||
[
|
||||
FritzboxSwitch(coordinator, ain)
|
||||
for ain in coordinator.new_devices
|
||||
if coordinator.data.devices[ain].has_switch
|
||||
]
|
||||
)
|
||||
|
||||
entry.async_on_unload(coordinator.async_add_listener(_add_entities))
|
||||
|
|
Loading…
Reference in New Issue