diff --git a/custom_components/neerslag/__init__.py b/custom_components/neerslag/__init__.py index 2e9642d..c7739a8 100644 --- a/custom_components/neerslag/__init__.py +++ b/custom_components/neerslag/__init__.py @@ -29,7 +29,7 @@ async def options_update_listener(hass: HomeAssistant, config_entry: ConfigEntry async def async_setup(hass: HomeAssistant, config_entry: dict): """Set up the Neerslag Sensor (Buienalarm / Buienradar) component.""" hass.data.setdefault(DOMAIN, {}) - setup_view(hass) + await setup_view(hass) return True @@ -50,10 +50,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry): hass_data["unsub_options_update_listener"] = unsub_options_update_listener hass.data[DOMAIN][config_entry.entry_id] = hass_data - for platform in PLATFORMS: - hass.async_create_task( - hass.config_entries.async_forward_entry_setup(config_entry, platform) - ) + await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS) return True diff --git a/custom_components/neerslag/load_frontend.py b/custom_components/neerslag/load_frontend.py index c47c9ee..3b7c510 100644 --- a/custom_components/neerslag/load_frontend.py +++ b/custom_components/neerslag/load_frontend.py @@ -1,5 +1,6 @@ from homeassistant.core import HomeAssistant from homeassistant.components.frontend import add_extra_js_url +from homeassistant.components.http import StaticPathConfig from aiohttp import web import logging import os @@ -9,13 +10,13 @@ _LOGGER = logging.getLogger(__name__) -def setup_view(hass: HomeAssistant): +async def setup_view(hass: HomeAssistant): dir_path = os.path.dirname(os.path.realpath(__file__)) path_to_file = "{}/home-assistant-neerslag-card/neerslag-card.js".format(dir_path) should_cache = False timestamp = str(time.time()) frontend_script_url_with_parameter = FRONTEND_SCRIPT_URL+"?cache="+timestamp + add_extra_js_url(hass, frontend_script_url_with_parameter , es5=False) - hass.http.register_static_path(FRONTEND_SCRIPT_URL, str(path_to_file), should_cache) - add_extra_js_url(hass, frontend_script_url_with_parameter , es5=False) \ No newline at end of file + await hass.http.async_register_static_paths([StaticPathConfig(FRONTEND_SCRIPT_URL, str(path_to_file), should_cache)]) \ No newline at end of file diff --git a/custom_components/neerslag/manifest.json b/custom_components/neerslag/manifest.json index 5fb080d..1c22e09 100644 --- a/custom_components/neerslag/manifest.json +++ b/custom_components/neerslag/manifest.json @@ -13,5 +13,5 @@ "@aex351" ], "iot_class" : "cloud_polling", - "version": "2024.05.05.0" + "version": "2024.12.29.0" } \ No newline at end of file