diff --git a/custom_components/nordpool/__init__.py b/custom_components/nordpool/__init__.py index b2a46cb..61076d0 100644 --- a/custom_components/nordpool/__init__.py +++ b/custom_components/nordpool/__init__.py @@ -7,6 +7,7 @@ import voluptuous as vol from homeassistant.config_entries import ConfigEntry from homeassistant.core import Config, HomeAssistant +from homeassistant.const import Platform from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.event import async_track_time_change @@ -44,6 +45,8 @@ ------------------------------------------------------------------- """ +PLATFORMS: list[Platform] = [Platform.SENSOR] + class NordpoolData: """Holds the data""" @@ -197,9 +200,7 @@ async def async_setup(hass: HomeAssistant, config: Config) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up nordpool as config entry.""" res = await _dry_setup(hass, entry.data) - hass.async_create_task( - hass.config_entries.async_forward_entry_setup(entry, "sensor") - ) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) entry.add_update_listener(async_reload_entry) return res @@ -207,7 +208,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" - unload_ok = await hass.config_entries.async_forward_entry_unload(entry, "sensor") + unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: # This is an issue if you have multiple sensors as everything related to DOMAIN diff --git a/custom_components/nordpool/manifest.json b/custom_components/nordpool/manifest.json index db576fc..2db2ee3 100644 --- a/custom_components/nordpool/manifest.json +++ b/custom_components/nordpool/manifest.json @@ -17,4 +17,4 @@ "backoff" ], "version": "0.0.14" -} \ No newline at end of file +}