Install requirements of after_dependencies when loading integrations (#29491)

* Install requirements of after_dependencies when loading integrations

* Fix smartthings test
This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2019-12-05 09:28:56 +01:00
1 parent 957e5018f4
commit e99184bf68
19 files changed
+57 -98

No files matched your search

@@ -37,9 +37,7 @@ class RegistrationsView(HomeAssistantView):
webhook_id = generate_secret()
cloud_loaded = "cloud" in hass.config.components
if cloud_loaded and hass.components.cloud.async_active_subscription():
if hass.components.cloud.async_active_subscription():
data[
CONF_CLOUDHOOK_URL
] = await hass.components.cloud.async_create_cloudhook(webhook_id)
@@ -59,11 +57,10 @@ class RegistrationsView(HomeAssistantView):
)
remote_ui_url = None
if cloud_loaded:
try:
remote_ui_url = hass.components.cloud.async_remote_ui_url()
except hass.components.cloud.CloudNotAvailable:
pass
try:
remote_ui_url = hass.components.cloud.async_remote_ui_url()
except hass.components.cloud.CloudNotAvailable:
pass
return self.json(
{
@@ -5,5 +5,6 @@
"documentation": "https://www.home-assistant.io/integrations/mobile_app",
"requirements": ["PyNaCl==1.3.0"],
"dependencies": ["http", "webhook"],
"after_dependencies": ["cloud"],
"codeowners": ["@robbiet480"]
}
@@ -309,10 +309,9 @@ async def handle_webhook(
if CONF_CLOUDHOOK_URL in registration:
resp[CONF_CLOUDHOOK_URL] = registration[CONF_CLOUDHOOK_URL]
if "cloud" in hass.config.components:
try:
resp[CONF_REMOTE_UI_URL] = hass.components.cloud.async_remote_ui_url()
except hass.components.cloud.CloudNotAvailable:
pass
try:
resp[CONF_REMOTE_UI_URL] = hass.components.cloud.async_remote_ui_url()
except hass.components.cloud.CloudNotAvailable:
pass
return webhook_response(resp, registration=registration, headers=headers)
@@ -115,7 +115,7 @@ async def websocket_delete_registration(
except HomeAssistantError:
return error_message(msg["id"], "internal_error", "Error deleting registration")
if CONF_CLOUDHOOK_URL in registration and "cloud" in hass.config.components:
if CONF_CLOUDHOOK_URL in registration:
await hass.components.cloud.async_delete_cloudhook(webhook_id)
connection.send_message(result_message(msg["id"], "ok"))