Issue connecting Smartthings to hass (Error - Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble)

Hi all

I am quite new to home assistant & I am trying to integrate Smartthings into hass.
This seemed to be fairly easy, but yet I stumble upon an error when trying to do so.

I have searched for similar issues in the forum, but not found a solution to my problem.
Perhaps a fresh re-install of hass is the only solution.

  • I am running hass on a Raspberry Pi 4
  • I have a Home assistant Cloud account (Nabu Casa)
  • I can connect to my hass remotely
  • I have a personal token from Smartthings (But I have nowhere to add it, since I do not get that far)

When I try to “+ Add integration”

  • Search for Smartthings, => click to add it
  • I get an error stating the following:
    – “Error - Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble”

The log is saying this:

Logger: aiohttp.server
Source: components/webhook/__init__.py:46
First occurred: October 25, 2022 at 15:20:43 (17 occurrences)
Last logged: 10:08:58

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!
3 Likes

Dido

Lol, I’m running into the same issues as you. Same setup all the way down to the same log file message. Hopefully we can find a solution.

I found my issue. Hopefully this fixes yours. Go to your editor in Home Ass. I removed ssl_certificate: /ssl/fullchain.pem & ssl_key: /ssl/privkey.pem. Navigate to Developer Tools on your side bar. Hit the check configuration. If it passes hit restart button on the right. When HA comes back online “mine took 10min.” Try re-adding SmartThings. It should now work.

Same issue here. Where do I find the pem references? There’s nothing in configuration.yaml and I have an SSL directory but it’s empty.

Having this same issue. Also I cannot find the SSL entry mentioned above as a fix.

Just solved this as follows on Home Assistant core v 2022.11.1, Home Assistant OS v 9.3:

SSH to your Home Assistant. (I used SSH and Web Terminal Addon).
Change to the hidden config/.storage directory
Rename Smartthings to Smarttthings.sav (note Unix rename command is mv)
Go back and try to add the integration again.

I probably could have edited that smartthings file because I noticed the webhook value was missing from it, but this worked.

7 Likes

^^ THIS! Thank you.

Thanks. You saved my life! My wife going to kill me if I delay fixing this issue…

For me it says Smartthings does not exist, so I can’t rename it.

Worked for me too! Thanks so much!

Hello!

I am having the same issue. But I don’t quite understand the bit
“Change to the hidden config/.storage directory. Rename Smartthings to Smarttthings.sav”

I have logged in via Putty, what now?

Sorry for these stupid questions, but I am completely new to Rasperry Pi and Home Assistant. I am trying to get SmartThings integration to work. Getting the same error as you guys. Running HA v9.5

Ok, I managed to view the .storage folder. Removed it from exclusion in VSCode. And I renamed the SmartThings file to SmartThings.sav

And it worked! Thanks

Just worked for me! thx for thAT, did it throu samba on my windows pc

How can i get to the hidden config/.storage?

Hate to necromance, but just wanted to say that the chosen solution above worked for me as well.

@Chongwon, go to Settings > Add-ons, then install the “Advanced SSH & Web Terminal” add-on. Go to the configuration section once installed, set a username and password, and restart your device. Once back on, turn on the service, and you’ll be in the ssh terminal. Type cd /root/config/.storage, hit enter. Then type mv smartthings smartthings.sav, following the instructions above. Then try your integration again.

1 Like