From 8d433aa48130af6589796a01b25afc51f752308a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Pelgr=C3=B6m?= Date: Mon, 5 Dec 2022 03:10:26 +0100 Subject: [PATCH] Fix mobile_app returning cloud URL when not subscribed (#83257) fixes undefined --- homeassistant/components/mobile_app/http_api.py | 5 +++-- homeassistant/components/mobile_app/webhook.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/mobile_app/http_api.py b/homeassistant/components/mobile_app/http_api.py index ea8c56d1a7c..3c34a291df1 100644 --- a/homeassistant/components/mobile_app/http_api.py +++ b/homeassistant/components/mobile_app/http_api.py @@ -91,8 +91,9 @@ class RegistrationsView(HomeAssistantView): ) remote_ui_url = None - with suppress(hass.components.cloud.CloudNotAvailable): - remote_ui_url = cloud.async_remote_ui_url(hass) + if cloud.async_active_subscription(hass): + with suppress(hass.components.cloud.CloudNotAvailable): + remote_ui_url = cloud.async_remote_ui_url(hass) return self.json( { diff --git a/homeassistant/components/mobile_app/webhook.py b/homeassistant/components/mobile_app/webhook.py index cd54c4216b5..2dd578a3fea 100644 --- a/homeassistant/components/mobile_app/webhook.py +++ b/homeassistant/components/mobile_app/webhook.py @@ -693,8 +693,9 @@ async def webhook_get_config( if CONF_CLOUDHOOK_URL in config_entry.data: resp[CONF_CLOUDHOOK_URL] = config_entry.data[CONF_CLOUDHOOK_URL] - with suppress(hass.components.cloud.CloudNotAvailable): - resp[CONF_REMOTE_UI_URL] = cloud.async_remote_ui_url(hass) + if cloud.async_active_subscription(hass): + with suppress(hass.components.cloud.CloudNotAvailable): + resp[CONF_REMOTE_UI_URL] = cloud.async_remote_ui_url(hass) webhook_id = config_entry.data[CONF_WEBHOOK_ID]