mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
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 * Cleanup
This commit is contained in:
parent
6d7fb9f46a
commit
675525f47c
@ -24,7 +24,7 @@ from homeassistant.const import (
|
|||||||
CONF_TOKEN,
|
CONF_TOKEN,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import CoreState, callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import (
|
from homeassistant.helpers import (
|
||||||
aiohttp_client,
|
aiohttp_client,
|
||||||
@ -422,6 +422,12 @@ class SimpliSafe:
|
|||||||
@callback
|
@callback
|
||||||
def _async_process_new_notifications(self, system):
|
def _async_process_new_notifications(self, system):
|
||||||
"""Act on any new system notifications."""
|
"""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, [])
|
old_notifications = self._system_notifications.get(system.system_id, [])
|
||||||
latest_notifications = system.notifications
|
latest_notifications = system.notifications
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user