Merge pull request #4 from sudoxnym/fix-jellyfin-setup-error-and-deprecations.2025-09-15.06-04-26

Update Jellyfin integration for latest HA API
This commit is contained in:
sudoxnym 2025-09-15 00:06:25 -06:00 committed by GitHub
commit 6d480a1575
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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] = {}
hass.data[DOMAIN][config.get(CONF_URL)][platform]["entities"] = [] 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) 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): async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry):
_LOGGER.info("Unloading jellyfin") _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"] _jelly: JellyfinClientManager = hass.data[DOMAIN][config_entry.data.get(CONF_URL)]["manager"]
await _jelly.stop() await _jelly.stop()