mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Fix initial data load for System Bridge (#73339)
* Update package to 3.1.5 * Fix initial loading of data * Remove additional log and make method
This commit is contained in:
parent
d70ec35468
commit
297072c1f6
@ -98,19 +98,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
_LOGGER.debug("Data: %s", coordinator.data)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Wait for initial data
|
# Wait for initial data
|
||||||
async with async_timeout.timeout(30):
|
async with async_timeout.timeout(30):
|
||||||
while coordinator.data is None or all(
|
while not coordinator.is_ready():
|
||||||
getattr(coordinator.data, module) is None for module in MODULES
|
|
||||||
):
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Waiting for initial data from %s (%s): %s",
|
"Waiting for initial data from %s (%s)",
|
||||||
entry.title,
|
entry.title,
|
||||||
entry.data[CONF_HOST],
|
entry.data[CONF_HOST],
|
||||||
coordinator.data,
|
|
||||||
)
|
)
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
except asyncio.TimeoutError as exception:
|
except asyncio.TimeoutError as exception:
|
||||||
@ -118,6 +113,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
f"Timed out waiting for {entry.title} ({entry.data[CONF_HOST]})."
|
f"Timed out waiting for {entry.title} ({entry.data[CONF_HOST]})."
|
||||||
) from exception
|
) from exception
|
||||||
|
|
||||||
|
_LOGGER.debug(
|
||||||
|
"Initial coordinator data for %s (%s):\n%s",
|
||||||
|
entry.title,
|
||||||
|
entry.data[CONF_HOST],
|
||||||
|
coordinator.data.json(),
|
||||||
|
)
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = coordinator
|
hass.data[DOMAIN][entry.entry_id] = coordinator
|
||||||
|
|
||||||
|
@ -75,6 +75,16 @@ class SystemBridgeDataUpdateCoordinator(
|
|||||||
hass, LOGGER, name=DOMAIN, update_interval=timedelta(seconds=30)
|
hass, LOGGER, name=DOMAIN, update_interval=timedelta(seconds=30)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def is_ready(self) -> bool:
|
||||||
|
"""Return if the data is ready."""
|
||||||
|
if self.data is None:
|
||||||
|
return False
|
||||||
|
for module in MODULES:
|
||||||
|
if getattr(self.data, module) is None:
|
||||||
|
self.logger.debug("%s - Module %s is None", self.title, module)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
async def async_get_data(
|
async def async_get_data(
|
||||||
self,
|
self,
|
||||||
modules: list[str],
|
modules: list[str],
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "System Bridge",
|
"name": "System Bridge",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/system_bridge",
|
"documentation": "https://www.home-assistant.io/integrations/system_bridge",
|
||||||
"requirements": ["systembridgeconnector==3.1.3"],
|
"requirements": ["systembridgeconnector==3.1.5"],
|
||||||
"codeowners": ["@timmo001"],
|
"codeowners": ["@timmo001"],
|
||||||
"zeroconf": ["_system-bridge._tcp.local."],
|
"zeroconf": ["_system-bridge._tcp.local."],
|
||||||
"after_dependencies": ["zeroconf"],
|
"after_dependencies": ["zeroconf"],
|
||||||
|
@ -2268,7 +2268,7 @@ swisshydrodata==0.1.0
|
|||||||
synology-srm==0.2.0
|
synology-srm==0.2.0
|
||||||
|
|
||||||
# homeassistant.components.system_bridge
|
# homeassistant.components.system_bridge
|
||||||
systembridgeconnector==3.1.3
|
systembridgeconnector==3.1.5
|
||||||
|
|
||||||
# homeassistant.components.tailscale
|
# homeassistant.components.tailscale
|
||||||
tailscale==0.2.0
|
tailscale==0.2.0
|
||||||
|
@ -1504,7 +1504,7 @@ sunwatcher==0.2.1
|
|||||||
surepy==0.7.2
|
surepy==0.7.2
|
||||||
|
|
||||||
# homeassistant.components.system_bridge
|
# homeassistant.components.system_bridge
|
||||||
systembridgeconnector==3.1.3
|
systembridgeconnector==3.1.5
|
||||||
|
|
||||||
# homeassistant.components.tailscale
|
# homeassistant.components.tailscale
|
||||||
tailscale==0.2.0
|
tailscale==0.2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user