SmartThings Community

Can't Remove Home Assistant smartapp

(David Martinez) #1

I recently setup the new Home Assistant integration with ST, and had it working great. HOwever, I ran into a hardware issue, and had to switch back to my RPi for the time being. I’m trying to configure ST integration there again, but I’m running into an issue where the ST Classic app already has a smartapp for Home Assistant, and it won’t let me into the app to uninstall it.

I’ve deleted the old token, thinking that would solve the problem, but the app remains. I can’t find a listing of the app anywhere in the IDE. How do I get this off my Classic app??

1 Like
#2

Having the exact same issue! Working great and had an unrelated HW issue.
Trying to re-setup the HA side and now get “Unable to setup the SmartApp. Please try again.” I assume the issue is on the ST side and not being able to remove the SmartApp created with the previous HA hardware.

(Ryno Sharktooth) #3

Same issue here. Cannot delete the “Home Assistant” SmartApp through the ST Classic (iOS) app. Nor can I add a personal token to any of my HASS instances.

(Thomas Trombold) #4

Having the Same issues unable to get it working

(Greg White) #6

I am experiencing the same issue. The Smartthings integration is working again as I was able to recreate the integration and install a new SmartApp. The old SmartApp is still there and causing ‘unregistered webhook’ warnings in Home-Assistant.

(Andrew Sayre) #7

Hey Folks! I’m the creator of the integration with Home Assistant. This isn’t a SmartThings issue. It’s a quirk that occurs when the integration is removed in Home Assistant before removing it in the SmartThings app. It also happens if you reverted Home Assistant, removing the file (.storage/smartthings) which contains the identifier to identify the SmartApp, so then the integration creates a new one. This is by design as the integration allows any number of Home Assistant instances to control the same SmartThings Account.

See https://github.com/home-assistant/home-assistant/issues/21462 for more information.

The good news this can be cleaned up and I’ll write a utility this evening you can use to remove the orphaned instances of the SmartApp/Automation.

Thanks for your patience!
Andy

2 Likes
(Andrew Sayre) #8

Here’s the utility: https://pypi.org/project/hass-smartthings-remove/

pip install hass_smartthings_remove
hass_smartthings_remove PERSONAL_ACCESS_TOKEN

Note this will clean-up ALL Home Assistant apps/smartapps (as it can’t know which one is still valid anymore). If you’re still using the integration in Home Assistant, you’ll need to restart, then run the integration setup again.

(Greg White) #9

This solution works for me.

(Mr Skaven) #10

Can you explain how I run this script? My HA is a Hassio and I’m using a windows 10 computer

(Andrew Sayre) #11

You can run it locally assuming you have python installed–those are the lines to copy+paste into the terminal… I wouldn’t suggest installing it on Hassio.

(Richard Allen) #12

So what would you suggest to do if you are using Hassio

(Simon Tether) #13

If you open the new ST APP, you can delete the HA Smartapps that are no longer needed

(Richard Allen) #14

unfortunately it comes back

(Michael Renna) #15

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
sys.exit(main())
File “/usr/local/lib/python3.7/site-packages/hass_smartthings_remove/remove.py”, line 16, in main
loop.run_until_complete(remove_apps(args.token))
File “/usr/local/lib/python3.7/asyncio/base_events.py”, line 584, in run_until_complete
return future.result()
File “/usr/local/lib/python3.7/site-packages/hass_smartthings_remove/remove.py”, line 25, in remove_apps
apps = await api.apps()
File “/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py”, line 89, in apps
resp = await self._service.get_apps(params)
File “/usr/local/lib/python3.7/site-packages/pysmartthings/api.py”, line 156, in get_apps
return await self.get_items(API_APPS, params=params)
File “/usr/local/lib/python3.7/site-packages/pysmartthings/api.py”, line 375, in get_items
‘get’, self._api_base + resource, params, None)
File “/usr/local/lib/python3.7/site-packages/pysmartthings/api.py”, line 366, in request
resp.raise_for_status()
File “/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py”, line 942, in raise_for_status
headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 401, message=‘Unauthorized’
root@RennaNAS:/usr/src/app#

(Andrew Sayre) #16

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

(Michael Renna) #17

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.

(Bob Romero) #18

@andrewsayre, Since this integration is in Hass.io, 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?

(Andrew Sayre) #19

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 Hass.io. 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.
1 Like
(Javier Dst) #20

@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.
Thanks

(Bob Romero) #21

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?