Can't Remove Home Assistant smartapp

unfortunately it comes back

I get a 401, “unauthorized” error when I try to run it. Using portainer against a QNAP docker system hosting HASS. Any ideas on another approach to remove the app? Here is the trace:

Traceback (most recent call last):
File “/usr/local/bin/hass_smartthings_remove”, line 10, in
File “/usr/local/lib/python3.7/site-packages/hass_smartthings_remove/”, line 16, in main
File “/usr/local/lib/python3.7/asyncio/”, line 584, in run_until_complete
return future.result()
File “/usr/local/lib/python3.7/site-packages/hass_smartthings_remove/”, line 25, in remove_apps
apps = await api.apps()
File “/usr/local/lib/python3.7/site-packages/pysmartthings/”, line 89, in apps
resp = await self._service.get_apps(params)
File “/usr/local/lib/python3.7/site-packages/pysmartthings/”, line 156, in get_apps
return await self.get_items(API_APPS, params=params)
File “/usr/local/lib/python3.7/site-packages/pysmartthings/”, line 375, in get_items
‘get’, self._api_base + resource, params, None)
File “/usr/local/lib/python3.7/site-packages/pysmartthings/”, line 366, in request
File “/usr/local/lib/python3.7/site-packages/aiohttp/”, line 942, in raise_for_status
aiohttp.client_exceptions.ClientResponseError: 401, message=‘Unauthorized’

This means the token you passed in the command line is invalid…

hmmm. well i’ve had several tokens and don’t know how to recover them after the initial copy from the smartthings site. Not only that, i’ve deleted past ones on that same site trying to clean up old installs. How do you delete the smartapp with the new ST apps? I assume its the record I see under automations. Once I do that and go back into smartthings classic, i still see the home assistant app under marketplace, myapps. If I’ve removed the integration (or at least tried to by deleting under integrations in HA), should I still see that entry? If I click on it in ST classic, i get the same “something went wrong” message. Feel like I’ve got some cleanup still to do to start fresh. Also wondering if any of my issue is related to how I expose my HA externally. I use Caddy to reverse proxy.

@andrewsayre, Since this integration is in, And I really like Hass.oi with no interest of changing, I feel kind of pissed that there is no way to for me to clean up the old tokens. do you think you can you give us some guidance so if some one were to dig around in the CLI, they might find the files i need to delete?

I think there is some misunderstanding of how the integration works:

  • Tokens are tied to your SmartThings or Samsung account. You can use any valid token under the same account to setup the integration or clean it up using the removal utility. If you didn’t retain the token when created (which the instructions indicated to do), go create another one temporarily to use with the remove utility.
  • Deleting tokens does not remove the integration. It just removes access to your ST/Samsung account.
  • This is a Home Assistant integration, not There are no local files you can delete to solve OP’s problem.
  • The removal utility is what you need to use to remove the orphaned apps in Automations and Marketplace. It only requires a valid token and can be ran anywhere, as it uses the SmartThings cloud API. Note that in Home Assistant v0.90 (releasing 3/20), it will remove the apps when the integration is removed, but this requires a functioning integration.

@andrewsayre I have tried to create another token in order to fix the issue with the orphan Home Assistant Smart App but with no luck. It seems it is expecting the previous token I had used and removed. Therefore there is no way for me that I’m using Hass.IO to integrate the pluging you have done with my SmartThings account again. Then, do you have any other solution for people with Hass.IO?
Basically my question is: How can I integrate again your plugin with my SmartThings account if when I try it, it says that I can’t.

I was wondering, should I be on SmartThings v2 or SmartThings v3 for this to work? I am using android, which app should I be using? no matter how I try to do this, I can not get the SmartThings app to install correctly. SSL with Lets Encrypt is working perfectly and I have foll external access. what port is smartthings communicating on?

@Javier_Dst Please open an issue in the repo for the utility. Please include the output from when you run the utility. I’ll be happy to work with you there to figure out a solution.

Done! Thanks!

I’m using Smarthings v2 an v3 and it is exactly the same.

Hello. I removed Smartthings on HA v 0.89 and now I’m on 0.90.2 and try to install Smartthings again and have got this exact problem.
I run HA on Hassio on a Raspberry Pi 3. When I log in to terminal and try to install the removal utility it only runs Python 2,7 and the aiohttp fails to install. Can I install like Raspbian on another SD-card and run the Removal utility on that without having Home Assistant installed? Can I get this removal utility to run on HassIO? Can I manually write some commands and remove the orphaned apps? I’m new to Linux but experienced in computers in general and can’t fix this. PLEASE guide me.

I got it! Installed Python on my windows computer. Went into command prompt and into the python scripts folder. Executed “pip install hass_smartthings_remove” Package installed successfully. I then used hass_smartthings_remove most_recent_smartthings_token but got 401 Unauthorized. I then opened Chrome, logged in to and executed the hass_smartthings_remove again and it worked! I could then run the integration again and it worked.

Awesome, the utility fixed everything after upgrading to 0.90.

Getting this error message
No matching distribution found for aiohttp==3.5.4

Ubuntu 18.04.

What to do?

EDIT: Ran it on Windows. Works great.

Running the utility on Windows and getting the No matching distribution for aiohttp==3.5.4. Any thoughts?

Edit: JK, had an older version of python as default, using the latest resolved.

never mind I solved it… : )

Hi Andrewsayre and everybody.
After unsuccesfully trying to integrate my 2 samsung winfree 2018 ACs into HA (it looks like they have no opened ports) I chose to try the smarthings integration.
It worked at first try and both TVs and ACs were shown.
But there’a a quite big problem… the main climate entity for one of the ACs is not created.
They are identical, and one is working flawlessy.
I tried to remove integration remove smartapp, clean smartapp, generate new token… I don’t know what else I can try. i need some help to find the problem, it’s preventing me to manage the unit in the bedroom :frowning:
Any advice?

On Smarthings website everything looks ok, so I think the problem must be in the integration or somewhere on my hassio…

Uhm… i just noticed something strange on the device on smartthings website.
It does not detect room temperature, so maybe it’s not communicating correctly with smartthings cloud and because of this also with hassio integration.
Strange, because on smartthings app it’s working…

Removing and re-adding the unit in smartthings app did the trick!
Strange problem, onlt smartthings classic was reporting the same wrong temperature, the “new” smartthings was working normally.
If this happens to someone else… just delete and re-add the device in smartthings v2 app!

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.