mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 18:27:51 +00:00
Make toon fall back to webhooks if cloud is not available (#64981)
This commit is contained in:
parent
8b3e923f4b
commit
d4497e4b68
@ -61,11 +61,17 @@ class ToonDataUpdateCoordinator(DataUpdateCoordinator[Status]):
|
||||
if cloud.async_active_subscription(self.hass):
|
||||
|
||||
if CONF_CLOUDHOOK_URL not in self.entry.data:
|
||||
webhook_url = await cloud.async_create_cloudhook(
|
||||
self.hass, self.entry.data[CONF_WEBHOOK_ID]
|
||||
)
|
||||
data = {**self.entry.data, CONF_CLOUDHOOK_URL: webhook_url}
|
||||
self.hass.config_entries.async_update_entry(self.entry, data=data)
|
||||
try:
|
||||
webhook_url = await cloud.async_create_cloudhook(
|
||||
self.hass, self.entry.data[CONF_WEBHOOK_ID]
|
||||
)
|
||||
except cloud.CloudNotConnected:
|
||||
webhook_url = webhook.async_generate_url(
|
||||
self.hass, self.entry.data[CONF_WEBHOOK_ID]
|
||||
)
|
||||
else:
|
||||
data = {**self.entry.data, CONF_CLOUDHOOK_URL: webhook_url}
|
||||
self.hass.config_entries.async_update_entry(self.entry, data=data)
|
||||
else:
|
||||
webhook_url = self.entry.data[CONF_CLOUDHOOK_URL]
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user