Skip to content

Commit

Permalink
Fix childs for RFBridge #1389
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 19, 2024
1 parent 0f3e936 commit 846cc16
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions custom_components/sonoff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
raise ConfigEntryAuthFailed(e)
raise ConfigEntryNotReady(e)

if not config_entry.update_listeners:
config_entry.add_update_listener(async_update_options)

config_entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, registry.stop)
)

# important to run before registry.setup_devices (for remote childs)
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)

devices: list[dict] | None = None
store = Store(hass, 1, f"{DOMAIN}/{config_entry.data['username']}.json")

Expand Down Expand Up @@ -215,16 +225,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
else:
entities = None

if not config_entry.update_listeners:
config_entry.add_update_listener(async_update_options)

config_entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, registry.stop)
)

# this may only happen if async_setup_entry will fail
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)

if mode in ("auto", "cloud") and config_entry.data.get(CONF_PASSWORD):
registry.cloud.start(**config_entry.data)

Expand Down

0 comments on commit 846cc16

Please sign in to comment.