mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Lovelace: Fire event on save (#24104)
* Lovelace: Fire event on save * Add event to whitelist
This commit is contained in:
parent
9debbfb1a8
commit
5c86a51b45
@ -26,6 +26,7 @@ CONFIG_SCHEMA = vol.Schema({
|
|||||||
}),
|
}),
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
EVENT_LOVELACE_UPDATED = 'lovelace_updated'
|
||||||
|
|
||||||
LOVELACE_CONFIG_FILE = 'ui-lovelace.yaml'
|
LOVELACE_CONFIG_FILE = 'ui-lovelace.yaml'
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ class LovelaceStorage:
|
|||||||
"""Initialize Lovelace config based on storage helper."""
|
"""Initialize Lovelace config based on storage helper."""
|
||||||
self._store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
|
self._store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
|
||||||
self._data = None
|
self._data = None
|
||||||
|
self._hass = hass
|
||||||
|
|
||||||
async def async_get_info(self):
|
async def async_get_info(self):
|
||||||
"""Return the YAML storage mode."""
|
"""Return the YAML storage mode."""
|
||||||
@ -115,6 +117,8 @@ class LovelaceStorage:
|
|||||||
self._data['config'] = config
|
self._data['config'] = config
|
||||||
await self._store.async_save(self._data)
|
await self._store.async_save(self._data)
|
||||||
|
|
||||||
|
self._hass.bus.async_fire(EVENT_LOVELACE_UPDATED)
|
||||||
|
|
||||||
async def _load(self):
|
async def _load(self):
|
||||||
"""Load the config."""
|
"""Load the config."""
|
||||||
data = await self._store.async_load()
|
data = await self._store.async_load()
|
||||||
|
@ -10,6 +10,7 @@ from homeassistant.const import (
|
|||||||
EVENT_THEMES_UPDATED)
|
EVENT_THEMES_UPDATED)
|
||||||
from homeassistant.components.persistent_notification import (
|
from homeassistant.components.persistent_notification import (
|
||||||
EVENT_PERSISTENT_NOTIFICATIONS_UPDATED)
|
EVENT_PERSISTENT_NOTIFICATIONS_UPDATED)
|
||||||
|
from homeassistant.components.lovelace import EVENT_LOVELACE_UPDATED
|
||||||
from homeassistant.helpers.area_registry import EVENT_AREA_REGISTRY_UPDATED
|
from homeassistant.helpers.area_registry import EVENT_AREA_REGISTRY_UPDATED
|
||||||
from homeassistant.helpers.device_registry import EVENT_DEVICE_REGISTRY_UPDATED
|
from homeassistant.helpers.device_registry import EVENT_DEVICE_REGISTRY_UPDATED
|
||||||
from homeassistant.helpers.entity_registry import EVENT_ENTITY_REGISTRY_UPDATED
|
from homeassistant.helpers.entity_registry import EVENT_ENTITY_REGISTRY_UPDATED
|
||||||
@ -26,4 +27,5 @@ SUBSCRIBE_WHITELIST = {
|
|||||||
EVENT_AREA_REGISTRY_UPDATED,
|
EVENT_AREA_REGISTRY_UPDATED,
|
||||||
EVENT_DEVICE_REGISTRY_UPDATED,
|
EVENT_DEVICE_REGISTRY_UPDATED,
|
||||||
EVENT_ENTITY_REGISTRY_UPDATED,
|
EVENT_ENTITY_REGISTRY_UPDATED,
|
||||||
|
EVENT_LOVELACE_UPDATED,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user