diff --git a/custom_components/jellyfin/__init__.py b/custom_components/jellyfin/__init__.py index 1113156..45a2cef 100644 --- a/custom_components/jellyfin/__init__.py +++ b/custom_components/jellyfin/__init__.py @@ -195,7 +195,15 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry): hass.data[DOMAIN][config.get(CONF_URL)][platform] = {} hass.data[DOMAIN][config.get(CONF_URL)][platform]["entities"] = [] - await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS) + + if hasattr(hass.config_entries, "async_forward_entry_setups"): + await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS) + else: + for platform in PLATFORMS: + hass.async_create_task( + hass.config_entries.async_forward_entry_setup(config_entry, platform) + ) + async_dispatcher_send(hass, SIGNAL_STATE_UPDATED) @@ -210,7 +218,18 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry): async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry): _LOGGER.info("Unloading jellyfin") - unload_ok = await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS) + + if hasattr(hass.config_entries, "async_unload_platforms"): + unload_ok = await hass.config_entries.async_unload_platforms( + config_entry, PLATFORMS + ) + else: + unload_ok = True + for platform in PLATFORMS: + unload_ok = unload_ok and await hass.config_entries.async_forward_entry_unload( + config_entry, platform + ) + _jelly: JellyfinClientManager = hass.data[DOMAIN][config_entry.data.get(CONF_URL)]["manager"] await _jelly.stop()