Skip to content

Commit a331495

Browse files
committed
switch back to the listener approach from the dev docs example
1 parent e29ed03 commit a331495

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

homeassistant/components/synology_dsm/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
127127
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
128128

129129
if entry.options[CONF_BACKUP_SHARE]:
130-
_notify_backup_listeners(hass)
130+
hass.async_create_task(_notify_backup_listeners(hass), eager_start=False)
131131

132132
return True
133133

@@ -138,11 +138,11 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
138138
entry_data: SynologyDSMData = hass.data[DOMAIN][entry.unique_id]
139139
await entry_data.api.async_unload()
140140
hass.data[DOMAIN].pop(entry.unique_id)
141-
_notify_backup_listeners(hass)
141+
hass.async_create_task(_notify_backup_listeners(hass), eager_start=False)
142142
return unload_ok
143143

144144

145-
def _notify_backup_listeners(hass: HomeAssistant) -> None:
145+
async def _notify_backup_listeners(hass: HomeAssistant) -> None:
146146
for listener in hass.data.get(SYNOLOGY_DATA_BACKUP_AGENT_LISTENERS, []):
147147
listener()
148148

0 commit comments

Comments
 (0)