@@ -349,9 +349,8 @@ async def state_changed(event: HAEvent) -> None:
349
349
await State .update (new_vars , func_args )
350
350
351
351
async def hass_started (event : HAEvent ) -> None :
352
- _LOGGER .debug ("adding state changed listener and starting global contexts" )
352
+ _LOGGER .debug ("starting global contexts" )
353
353
await State .get_service_params ()
354
- hass .data [DOMAIN ][UNSUB_LISTENERS ].append (hass .bus .async_listen (EVENT_STATE_CHANGED , state_changed ))
355
354
start_global_contexts ()
356
355
357
356
async def hass_stop (event : HAEvent ) -> None :
@@ -367,6 +366,8 @@ async def hass_stop(event: HAEvent) -> None:
367
366
await Function .reaper_stop ()
368
367
369
368
# Store callbacks to event listeners so we can unsubscribe on unload
369
+ _LOGGER .debug ("adding state_changed listener" )
370
+ hass .data [DOMAIN ][UNSUB_LISTENERS ].append (hass .bus .async_listen (EVENT_STATE_CHANGED , state_changed ))
370
371
hass .data [DOMAIN ][UNSUB_LISTENERS ].append (
371
372
hass .bus .async_listen (EVENT_HOMEASSISTANT_STARTED , hass_started )
372
373
)
0 commit comments