Ensure existing SimpliSafe notifications trigger event on HASS startup (#34232)
* Ensure existing SimpliSafe notifications trigger event on HASS startup * Don't redefine a standing function each loop iteration * Wait until HASS state is "running" * Linting * Linting * Code review * Code review * Simplify * Code review * Cleanuppull/30283/head^2
parent
6d7fb9f46a
commit
675525f47c
|
@ -24,7 +24,7 @@ from homeassistant.const import (
|
|||
CONF_TOKEN,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import CoreState, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import (
|
||||
aiohttp_client,
|
||||
|
@ -422,6 +422,12 @@ class SimpliSafe:
|
|||
@callback
|
||||
def _async_process_new_notifications(self, system):
|
||||
"""Act on any new system notifications."""
|
||||
if self._hass.state != CoreState.running:
|
||||
# If HASS isn't fully running yet, it may cause the SIMPLISAFE_NOTIFICATION
|
||||
# event to fire before dependent components (like automation) are fully
|
||||
# ready. If that's the case, skip:
|
||||
return
|
||||
|
||||
old_notifications = self._system_notifications.get(system.system_id, [])
|
||||
latest_notifications = system.notifications
|
||||
|
||||
|
|
Loading…
Reference in New Issue