Smartthings problem with reintegration

I have had Smartthings installed on version 0.89 but had som issues with the connection to my air conditioner. In version 0.90 it stated in the Smartstings install instructions that if I had previously set up the component prior to 0.90.0 I had to remove all integrations and run thrugh the configuration again. I did that. I removed the integration, the smartapp and the token on smartthings webpage.

I created a new token on smartthings webpage and try to set up the integration again but just get “Unknown error occurred” have tried it twice without success.

In the system log I get this errors

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/real_ip.py", line 33, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/ban.py", line 68, in ban_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/auth.py", line 206, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/view.py", line 112, in handle
    result = await result
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/config/config_entries.py", line 154, in post
    return await super().post(request, flow_id)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/data_validator.py", line 46, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/data_entry_flow.py", line 86, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/data_entry_flow.py", line 80, in async_configure
    flow, step_id, user_input)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/data_entry_flow.py", line 98, in _async_handle_step
    result = await getattr(flow, method)(user_input)  # type: Dict
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/smartthings/config_flow.py", line 79, in async_step_user
    await setup_smartapp_endpoint(self.hass)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/smartthings/smartapp.py", line 200, in setup_smartapp_endpoint
    config[CONF_WEBHOOK_ID], smartapp_webhook)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/webhook/__init__.py", line 35, in async_register
    raise ValueError('Handler is already defined!')
ValueError: Handler is already defined!

It seems that I still have an old Smartapp installed that I can’t get rid off. If I try to add new SmartApp in Smartthings Classic I see Home Assistant but just get “An error occurred. Try install SmartApp again”

In my Home Assistant log I then get

Error processing webhook XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/webhook/init.py”, line 85, in async_handle_webhook
response = await webhook[‘handler’](hass, webhook_id, request)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/smartthings/smartapp.py”, line 412, in smartapp_webhook
manager = hass.data[DOMAIN][DATA_MANAGER]
KeyError: ‘smartthings’

Where can I delete this handler? I have been looking around on smartthings webpage but cant find it. In the new Smartthings app I see “Home assistant” under Automations after trying to add it in the Classic app. I can delete it but it is still there when trying to install a new smartapp inte the classic app and it keep on failing.

Any ideas please!!!

Hi,
I have a similar problem… I’ve upgraded to the 0.90 and:

2019-03-24 17:54:36 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/real_ip.py", line 33, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/ban.py", line 68, in ban_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/auth.py", line 206, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/view.py", line 112, in handle
    result = await result
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/config/config_entries.py", line 154, in post
    return await super().post(request, flow_id)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/data_validator.py", line 46, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/data_entry_flow.py", line 86, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/data_entry_flow.py", line 80, in async_configure
    flow, step_id, user_input)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/data_entry_flow.py", line 98, in _async_handle_step
    result = await getattr(flow, method)(user_input)  # type: Dict
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/smartthings/config_flow.py", line 79, in async_step_user
    await setup_smartapp_endpoint(self.hass)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/smartthings/smartapp.py", line 208, in setup_smartapp_endpoint
    hass, config[CONF_WEBHOOK_ID])
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/cloud/__init__.py", line 108, in async_create_cloudhook
    hook = await hass.data[DOMAIN].cloudhooks.async_create(webhook_id, True)
  File "/usr/local/lib/python3.7/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.

Same issue. Has anyone figured it out?

Yes. I downloaded python on Windows and used this guide https://pypi.org/project/hass-smartthings-remove/ with a new token and was able to remove the smartapp and start from scratch.

What version of home assistant were you using?

Happened when installing 0.90 from 0.89.x

same issue
i did thje python removal but that didnt help either
any luck?

File “/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py”, line 418, in start
resp = await task
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py”, line 458, in _handle
resp = await handler(request)
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py”, line 119, in impl
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/real_ip.py”, line 40, in real_ip_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 73, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 136, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 122, in handle
result = await result
File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 163, in post
return await super().post(request, flow_id)
File “/usr/src/homeassistant/homeassistant/components/http/data_validator.py”, line 48, in wrapper
result = await method(view, request, *args, **kwargs)
File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 90, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 89, in async_configure
result = await self._async_handle_step(flow, cur_step[“step_id”], user_input)
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 132, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File “/usr/src/homeassistant/homeassistant/components/smartthings/config_flow.py”, line 90, 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
hass, DOMAIN, “SmartApp”, config[CONF_WEBHOOK_ID], smartapp_webhook
File “/usr/src/homeassistant/homeassistant/components/webhook/init.py”, line 33, in async_register
raise ValueError(“Handler is already defined!”)
ValueError: Handler is already defined!

I keep getting this error, even after doing the hass_smartthings_remove things.