Followed the guide (and its troubleshooting steps!), but it’s clear something is still improperly configured. My attempts to remedy keep coming up short.
Running the HASS container on a Raspberry Pi (bullseye). Plenty of other integrations work, but SmartThings is being pesky. I’ve generated the PAT for SmartThings, but haven’t gotten far enough in the process to enter it.
Signed up for Nabu Casa earlier today and linked it to my local HASS instance. Looks like there’s already a webhook for SmartApp:
I keep getting this error when attempting to add an integration to SmartThings via the HASS UI (Settings > Devices & Services > Add Integration):
Error
Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble
Per the troubleshooting docs, the culprit is likely my config. I initially kept my initial onboarding settings since I’m using Nabu Casa cloud:
I then tried overwriting the external_url
in my config yaml (note: before attempting this, homeassistant:
— nor any of its children — were present in my configuration.yaml
):
homeassistant:
external_url: "https://hooks.nabu.casa/gAA..."
Save, restart, try to add SmartThings integration again. Same 500 error. Also tried this config, yielding the same 500 error:
homeassistant:
external_url: "https://hooks.nabu.casa/"
Enabled debug-level logs for HASS and found a couple tracebacks:
2022-12-05 12:25:42.433 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated 192.168.1.10 for /api/config/config_entries/flow using bearer token
2022-12-05 12:25:42.433 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/config/config_entries/flow to 192.168.1.10 (auth: True)
2022-12-05 12:25:42.435 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 148, in post
return await super().post(request)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
result = await method(view, request, data, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
result = await self._flow_mgr.async_init(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 225, in async_init
flow, result = await task
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 252, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data, init_done)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/usr/src/homeassistant/homeassistant/components/smartthings/config_flow.py", line 60, in async_step_user
await setup_smartapp_endpoint(self.hass)
File "/usr/src/homeassistant/homeassistant/components/smartthings/smartapp.py", line 226, in setup_smartapp_endpoint
webhook.async_register(
File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 46, in async_register
raise ValueError("Handler is already defined!")
ValueError: Handler is already defined!
2022-12-05 12:24:14.258 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 148, in post
return await super().post(request)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
result = await method(view, request, data, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
result = await self._flow_mgr.async_init(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 225, in async_init
flow, result = await task
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 252, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data, init_done)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/usr/src/homeassistant/homeassistant/components/smartthings/config_flow.py", line 60, in async_step_user
await setup_smartapp_endpoint(self.hass)
File "/usr/src/homeassistant/homeassistant/components/smartthings/smartapp.py", line 237, in setup_smartapp_endpoint
cloudhook_url = await cloud.async_create_cloudhook(
File "/usr/src/homeassistant/homeassistant/components/cloud/__init__.py", line 181, in async_create_cloudhook
hook = await hass.data[DOMAIN].cloudhooks.async_create(webhook_id, True)
File "/usr/local/lib/python3.10/site-packages/hass_nabucasa/cloudhooks.py", line 35, in async_create
raise ValueError("Hook is already enabled for the cloud.")
ValueError: Hook is already enabled for the cloud.
Other potentially relevant logs:
2022-12-05 12:22:07.379 INFO (MainThread) [snitun.utils.aiohttp_client] AioHTTP snitun client started on 127.0.0.1:40155
2022-12-05 12:22:29.815 INFO (MainThread) [snitun.utils.aiohttp_client] AioHTTP snitun client connected to: us-west-2-2.ui.nabu.casa:443
2022-12-05 12:22:29.816 DEBUG (MainThread) [hass_nabucasa.remote] Connected
2022-12-05 12:23:48.452 DEBUG (MainThread) [hass_nabucasa.cloud_api] Fetched https://accounts.nabucasa.com/payments/subscription_info (200)
2022-12-05 12:22:04.483 DEBUG (MainThread) [hass_nabucasa.iot] Publishing message:
{'handler': 'webhook-register',
'msgid': '~REDACTED~',
'payload': {'cloudhook_ids': ['~REDACTED~']}}
What should I try next?