mirror of
https://github.com/home-assistant/core.git
synced 2026-12-04 12:50:45 -04:00
Group sequential async_add_entities calls in Ohme (#187523)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
925c09a579
commit
85edb7778a
@@ -87,18 +87,20 @@ async def async_setup_entry(
|
||||
"""Set up switches."""
|
||||
coordinator = config_entry.runtime_data.device_info_coordinator
|
||||
|
||||
async_add_entities(
|
||||
entities: list[OhmeConfigSwitch | OhmeSwitch] = [
|
||||
OhmeConfigSwitch(coordinator, description)
|
||||
for description in SWITCH_CONFIG
|
||||
if description.is_supported_fn(coordinator.client)
|
||||
)
|
||||
]
|
||||
|
||||
async_add_entities(
|
||||
entities.extend(
|
||||
OhmeSwitch(coordinator, description)
|
||||
for description in SWITCH_DESCRIPTION
|
||||
if description.is_supported_fn(coordinator.client)
|
||||
)
|
||||
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class OhmeSwitch(OhmeEntity, SwitchEntity):
|
||||
"""Generic switch for Ohme."""
|
||||
|
||||
Reference in New Issue
Block a user