mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Reolink unsubscribe webhook when first refresh fails (#87147)
* catch ValueError on webhook async_register * add ONVIF to webhook_id * Unsubscribe webhook when ConfigEntryNotReady for async_config_entry_first_refresh * Revert catching ValueError
This commit is contained in:
parent
f9d7d65f3a
commit
f439a94a0d
@ -80,7 +80,11 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
update_interval=timedelta(seconds=DEVICE_UPDATE_INTERVAL),
|
update_interval=timedelta(seconds=DEVICE_UPDATE_INTERVAL),
|
||||||
)
|
)
|
||||||
# Fetch initial data so we have data when entities subscribe
|
# Fetch initial data so we have data when entities subscribe
|
||||||
await coordinator_device_config_update.async_config_entry_first_refresh()
|
try:
|
||||||
|
await coordinator_device_config_update.async_config_entry_first_refresh()
|
||||||
|
except ConfigEntryNotReady as err:
|
||||||
|
await host.stop()
|
||||||
|
raise err
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = ReolinkData(
|
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = ReolinkData(
|
||||||
host=host,
|
host=host,
|
||||||
|
@ -250,7 +250,7 @@ class ReolinkHost:
|
|||||||
|
|
||||||
async def register_webhook(self) -> None:
|
async def register_webhook(self) -> None:
|
||||||
"""Register the webhook for motion events."""
|
"""Register the webhook for motion events."""
|
||||||
self.webhook_id = f"{DOMAIN}_{self.unique_id.replace(':', '')}"
|
self.webhook_id = f"{DOMAIN}_{self.unique_id.replace(':', '')}_ONVIF"
|
||||||
event_id = self.webhook_id
|
event_id = self.webhook_id
|
||||||
|
|
||||||
webhook.async_register(
|
webhook.async_register(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user