diff --git a/custom_components/nordpool/__init__.py b/custom_components/nordpool/__init__.py index ee4f6f8..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,7 +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) - await hass.config_entries.async_forward_entry_setups(entry, ["sensor"]) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) entry.add_update_listener(async_reload_entry) return res @@ -205,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