Adjust config entry state checks in reolink (#138909)
parent
0949f7d0ba
commit
2f7a8b4d9d
|
@ -18,7 +18,6 @@ from homeassistant.components.media_source import (
|
|||
Unresolvable,
|
||||
)
|
||||
from homeassistant.components.stream import create_stream
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
|
@ -151,9 +150,7 @@ class ReolinkVODMediaSource(MediaSource):
|
|||
|
||||
entity_reg = er.async_get(self.hass)
|
||||
device_reg = dr.async_get(self.hass)
|
||||
for config_entry in self.hass.config_entries.async_entries(DOMAIN):
|
||||
if config_entry.state != ConfigEntryState.LOADED:
|
||||
continue
|
||||
for config_entry in self.hass.config_entries.async_loaded_entries(DOMAIN):
|
||||
channels: list[str] = []
|
||||
host = config_entry.runtime_data.host
|
||||
entities = er.async_entries_for_config_entry(
|
||||
|
|
|
@ -40,7 +40,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
|||
if (
|
||||
config_entry is None
|
||||
or device is None
|
||||
or config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
or config_entry.state != ConfigEntryState.LOADED
|
||||
):
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
|
|
Loading…
Reference in New Issue