Better cloud check (#21875)

This commit is contained in:
Paulus Schoutsen 2019-03-09 12:15:16 -08:00 committed by GitHub
parent ac5ccd651c
commit f4f0d363ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 19 deletions

View file

@ -46,11 +46,9 @@ class RegistrationsView(HomeAssistantView):
webhook_id = generate_secret()
if "cloud" in hass.config.components:
cloudhook = await async_create_cloudhook(hass, webhook_id)
if cloudhook is not None:
data[CONF_CLOUDHOOK_URL] = cloudhook[CONF_CLOUDHOOK_URL]
if hass.components.cloud.async_active_subscription():
data[CONF_CLOUDHOOK_URL] = \
await async_create_cloudhook(hass, webhook_id)
data[CONF_WEBHOOK_ID] = webhook_id