Integration Smartthings fails

Fixed it for me. Thank you so much for posting the linux command line step-by-step. That’s exactly what I was looking for.

I seem to be having the same problem here and have tried all the suggestions from this thread.

I had the integration set up and working but had removed some devices from the smart things integration and they still existed in home assistant, I could not find a way to remove these devices anywhere I searched, found a thread on the forum where people indicated the only real way to remove un-used devices was to remove and re-add the integration so I removed the integration which went fine but when I try to re-add it I get an error reporting “config flow could not be loaded” no matter what I try.

I have removed the left over file from config.storage and have also set the Nabu casa URL up under my external URL but I cannot seem to get past the “config flow could not be loaded” message, tried many reboots too.
image

Checking the log shows this error

Also every so often when I press add integration HA just hangs like this.

I also found steps in the main integration page

initially I was not able to install the ‘pip install hass_smartthings_remove’ application, I kept getting an error reporting failed to build wheel due to multidict error reporting error ‘gcc’ failed with exit status 1

After a bit of research I found that another user had similar issues and fixed them using the following commands

~ $ apk add python3
~ $ apk add python3-dev
~ $ apk add gcc musl-dev
~ $ pip3 install insteonplm (for example)

So after I ran above commands via a putty terminal session to HA I was able to install the removal application, once you install the removal application the instruction is to remove the personal access token using the following command:
hass_smartthings_remove PERSONAL_ACCESS_TOKEN

When I ran this I seem to get a 401 unauthorised error

I am really at a loss here I have spent upwards of 5 hours + trying to rectify this mess and really don’t know what I can do next???

Any help or guidance would really be appreciated

Here is aother error I seem to be getting from the logs:

Logger: aiohttp.server
Source: components/webhook/__init__.py:45
First occurred: 20:37:20 (2 occurrences)
Last logged: 20:52:26

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, 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 92, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 130, in post
    return await super().post(request)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *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 197, in async_init
    flow, result = await task
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 224, 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 320, 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 225, in setup_smartapp_endpoint
    webhook.async_register(
  File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 45, in async_register
    raise ValueError("Handler is already defined!")
ValueError: Handler is already defined!

So no idea how or why but it just started working after hours of trying! happy its working but sad as I dont know why or how!

This was the solution. That file should be removed by default when you remove the integration and I’m not sure why it’s not being done.

Same situation as everyone else, old, orphaned entries were competing with disabled devices (e.g. left_lamp was there and I had left_lamp_2 messing up all of my stuff).

Thanks thats works for me !

Worked perfectly. Thank you!

Worked like a charm … thanks :smile:

Removing the smart things dir and reattempting install worked for me!

Also worked for me! Thank you!