Adjust config entry state check in vizio (#138905)

This commit is contained in:
Erik Montnemery 2025-02-20 16:18:57 +01:00 committed by GitHub
parent 73442e8443
commit f828b4e0b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@ from __future__ import annotations
from typing import Any
from homeassistant.components.media_player import MediaPlayerDeviceClass
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE_CLASS, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.storage import Store
@ -39,12 +39,9 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
unload_ok = await hass.config_entries.async_unload_platforms(
config_entry, PLATFORMS
)
# Exclude this config entry because its not unloaded yet
if not any(
entry.state is ConfigEntryState.LOADED
and entry.entry_id != config_entry.entry_id
and entry.data[CONF_DEVICE_CLASS] == MediaPlayerDeviceClass.TV
for entry in hass.config_entries.async_entries(DOMAIN)
entry.data[CONF_DEVICE_CLASS] == MediaPlayerDeviceClass.TV
for entry in hass.config_entries.async_loaded_entries(DOMAIN)
):
hass.data[DOMAIN].pop(CONF_APPS, None)