Guard cloud check (#27901)

* Guard cloud check

* Fix pos args
This commit is contained in:
Paulus Schoutsen 2019-10-18 18:08:54 -07:00 committed by Andrew Sayre
parent 9e8c391c81
commit d98114d2ab
6 changed files with 33 additions and 9 deletions

View file

@ -78,7 +78,10 @@ class OwnTracksFlow(config_entries.ConfigFlow):
async def _get_webhook_id(self):
"""Generate webhook ID."""
webhook_id = self.hass.components.webhook.async_generate_id()
if self.hass.components.cloud.async_active_subscription():
if (
"cloud" in self.hass.config.components
and self.hass.components.cloud.async_active_subscription()
):
webhook_url = await self.hass.components.cloud.async_create_cloudhook(
webhook_id
)