Can't Remove Home Assistant smartapp

where do run this PIP command sorry?

im running hass.io on my RPI4

I finally got it working on Hass.io, likely used unnecessary steps but I am not very techy.

  1. Install SSH add-on from hass.io add-on store, configure a password in the configuration, and start
  2. SSH into your Hassio using a client like Putty (connect to hassio.local, use port 22), connect as root, use passwords you configured earlier in SSH add-on
  3. Install Python 3 while connected to SSH by running: apk add --no-cache python3, wait for the install to complete
  4. Install the removal tool using: pip3 install hass_smartthings_remove, wait for it to finish
  5. Run the tool using: hass_smartthings_remove PERSONAL_ACCESS_TOKEN, replace this last part (PERSONAL_ACCESS_TOKEN) with the access token you saved from earlier, or generate a new one per instructions in earlier link on Smartthings
  6. Go back to Smartthings smart apps to verify that the app is now removed

I hope that this helps, it worked for me

3 Likes

HERO - thanks so much!!

to note: ive since been able ot run this hass-smartthings-remove · PyPI
ive then deleted all tokens on ST side, removed the app and added again, then rebooted my RPI4.
the good news is that it did clear out all my “HA Apps” on the ST App, however i still cant add the intergration at this point.

when i try again, i still get this error in the logs:

Log Details (ERROR)
Sun Nov 03 2019 11:12:58 GMT+0000 (Greenwich Mean Time)
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/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 237, in setup_smartapp_endpoint
hass, config[CONF_WEBHOOK_ID]
TypeError: async_create_cloudhook() takes 2 positional arguments but 3 were given

Hi @MaroM,
on point 3 system gave me an error.
I run this command: apk add --no-cache python3 but the answer is: bash: apk: Command not found

Could you help me please?
Regards,

Alessandro

I am not at all a techy, but with searching it seems that the command works on particular builds but not others. Are you using it on Hassio on raspberry pi? Hopefully someone with better experience can help us

Yes, i’m using Hassio on Raspberry PI3.

Sorry if everyone knows this, it’s clearly stated in the instructions which I missed when I tried: Home Assistant integration setup requires using the SmartThings Classic mobile app, not the other (“modern”?) SmartThings app.

If you try it using the modern SmartThings mobile app, the Home Assistant SmartApp icon appears, but tapping it does nothing; no error, no spinning icon, it doesn’t respond at all.

Hello, I am having a similar issue where I am unable to install the hass_smartthings_remove and have attempted multiple times. I am running a Raspberry PI4 with hassio. I have putty’ed ssh’ed in successfully and it appears I have ran apk add --no-cache python3 without any issues and then when I attempt to run pip3 install hass_smartthings_remove I get the following:

Running setup.py install for multidict … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.7 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-7lx2uh_9/multidict/setup.py’"’"’; file=’"’"’/tmp/pip-install-7lx2uh_9/multidict/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-nodq5e4r/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-7lx2uh_9/multidict/

Do I have the wrong version of python? I would really appreciate help, I am a novice.
Additionally, would I dig up my old PERSONAL ACCESS TOKEN from my Home Assistant Cloud previous smartapp(smartthings)? It appears to be one.

Thank you!

I can’t get it to work either… no idea what I’m doing wrong.

Here’s the error message when running this using python on HASSIO:

Running setup.py install for multidict … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.7 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-mqu_zipl/multidict/setup.py’"’"’; file=’"’"’/tmp/pip-install-mqu_zipl/multidict/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-l_befq7o/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-mqu_zipl/multidict/
Complete output (49 lines):
**********************
* Accellerated build *
**********************
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict_base.py -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict_py.py -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_compat.py -> build/lib.linux-armv7l-3.7/multidict
copying multidict/init.py -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_abc.py -> build/lib.linux-armv7l-3.7/multidict
running egg_info
writing multidict.egg-info/PKG-INFO
writing dependency_links to multidict.egg-info/dependency_links.txt
writing top-level names to multidict.egg-info/top_level.txt
reading manifest file ‘multidict.egg-info/SOURCES.txt’
reading manifest template ‘MANIFEST.in’
warning: no previously-included files matching ‘.pyc’ found anywhere in distribution
warning: no previously-included files found matching ‘multidict/_multidict.html’
warning: no previously-included files found matching 'multidict/
.so’
warning: no previously-included files found matching ‘multidict/.pyd’
warning: no previously-included files found matching 'multidict/
.pyd’
no previously-included directories found matching ‘docs/_build’
writing manifest file ‘multidict.egg-info/SOURCES.txt’
copying multidict/init.pyi -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_istr.c -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_istr.h -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict.c -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict.pyx -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict_iter.c -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict_iter.h -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict_iter.pxd -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict_views.c -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict_views.h -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_multidict_views.pxd -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_pair_list.c -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_pair_list.h -> build/lib.linux-armv7l-3.7/multidict
copying multidict/_pair_list.pxd -> build/lib.linux-armv7l-3.7/multidict
copying multidict/py.typed -> build/lib.linux-armv7l-3.7/multidict
running build_ext
building ‘multidict._multidict’ extension
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/multidict
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.7m -c multidict/_multidict.c -o build/temp.linux-armv7l-3.7/multidict/_multidict.o -O2 -std=c99 -Wall -Wsign-compare -Wconversion -fno-strict-aliasing
unable to execute ‘gcc’: No such file or directory
error: command ‘gcc’ failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.7 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-oc1am58u/multidict/setup.py’"’"’; file=’"’"’/tmp/pip-install-oc1am58u/multidict/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-hdi_vx_0/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

Here’s my error message when running this using python on windows:

D:\Program Files\Python\Python38-32\Scripts>hass_Smartthings_remove cb71b2ed-d4df-4bae-ba35-6865544f25f6
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0351D388>
Traceback (most recent call last):
File “d:\program files\python\python38-32\lib\asyncio\proactor_events.py”, line 116, in del
self.close()
File “d:\program files\python\python38-32\lib\asyncio\proactor_events.py”, line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File “d:\program files\python\python38-32\lib\asyncio\base_events.py”, line 711, in call_soon
self._check_closed()
File “d:\program files\python\python38-32\lib\asyncio\base_events.py”, line 504, in _check_closed
raise RuntimeError(‘Event loop is closed’)
RuntimeError: Event loop is closed

Same issue and results as Traxtar928
Mine is a reinstall after a Snapshot Wipe & Restore
Started with Network Error and crashing Smarthings Classic and Current App @ Integration Install
Working in pi3B with Hassio, python 3.7.5, pip 19.2.3

The method has worked previously without issue.

1 Like

Also getting same problem on Hassio. Appreciate any update to resolve this.

Semi glad to see I am not alone, thank you all for the response. Bump

Worrying that an app can embed itself, cause problems then not be uninstallable. I guess that’s the risk we take when loading these…

To anyone who is having issues with the methods mentioned above for deleting the SmartApps:

I also had an installation of a SmartApp go defunct and was unable to get it removed from my account because it was not showing on the Samsung graph api website…I did find however, that the REST api of Samsung did show it in my list of apps. Since I am well versed in API integrations, I leveraged the following commands to remove it and hope it can help (simply) solve the problems for others:

Requirement to delete the SmartApp:

  1. A Smartthings API token generated. It will be known below as <Smartthings_Token>. Generate a new token here:
    https://account.smartthings.com/tokens

  2. Either the SmartApp ID or AppName (the back-end name, not the clear-text name you see in the list). Don’t worry, I will show you how to find this below…

Steps:

  1. Get a list of all SmartApps:
    curl --header "Authorization: Bearer <Smartthings_Token>" https://api.smartthings.com/v1/apps

If you have trouble with the output you can use this to format the output to make it a bit more readable:
curl --header "Authorization: Bearer <Smartthings_Token>" https://api.smartthings.com/v1/apps | python -m json.tool

In this command output, find the appId relating to the application you wish to remove. You will use it in the below command. The appId will be known below as .

  1. Delete the SmartApp using the rest api:
    curl -X DELETE --header "Authorization: Bearer <Smartthings_Token>" https://api.smartthings.com/v1/apps/<AppId>

Done. You can re-run the step above and ensure it deleted the app.

Notes:

If you wish to do any other API type of actions, you can review the API documentation here:
https://smartthings.developer.samsung.com/docs/api-ref/st-api.html#section/Overview

Not sure if this will fix everyone’s issue or not, but it worked for me. Hope it helps.

1 Like

I tried that and it certainly appeared to do something but the Smartapp is still there.

I just reinstalled the Home Assistant webhook app again just to show it in action to see if that helps…

  • <SmartThings Token> = Provided as mentioned by the link above (Samsung account). Do not leave the < and > characters as they only represent that you have a variable/text that you need to replace specific to your account.

curl --header “Authorization: Bearer <SmartThings Token>https://api.smartthings.com/v1/apps | python -m json.tool

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 365 100 365 0 0 595 0 --:–:-- --:–:-- --:–:-- 595

{"items": [
    {
        "appName": "homeassistant.<hiding this output>",
        "appId": "b15b3203-de33-4f24-a76f-0e71a6d02ae3", <---- This is what I append to the end of the next curl command
        "appType": "WEBHOOK_SMART_APP",
        "classifications": [
            "AUTOMATION"
        ],
        "displayName": "Home Assistant",
        "description": "<hiding this output>",
        "iconImage": {},
        "createdDate": "2019-11-30T16:31:39Z",
        "lastUpdatedDate": "2019-11-30T16:31:40Z"
    }
],
"_links": {}

}

curl --header “Authorization: Bearer <SmartThings Token>” -X DELETE https://api.smartthings.com/v1/apps/b15b3203-de33-4f24-a76f-0e71a6d02ae3 | python -m json.tool

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2 100 2 0 0 3 0 --:–:-- --:–:-- --:–:-- 3

{}

The delete command output appears to always return null/empty whether it worked or not…I simply love APIs like that . Anyways to double check if it worked, just rerun the first command again.

curl --header “Authorization: Bearer <SmartThings Token>https://api.smartthings.com/v1/apps | python -m json.tool

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 24 100 24 0 0 35 0 --:–:-- --:–:-- --:–:-- 35

{
“items”: ,
“_links”: {}
}

Now its gone. Then just throw away/exit the Samsung SmartThings app and reopen it back up. Go to the screen as if you were going to install a smart app again and it should be gone from the bottom of the list after it updates the list within a few seconds.

Let me know if that helps you with a more specific example… this may not account for the Classic SmartThings app/account, but I could look into that if needed…

  • Update-Edited to fix formatting issues…

I’m pretty sure it worked here’s what I originally ran and the result:

curl --header "Authorization: Bearer a8d6764b-9e4a-4c74-a7b4-42a1a597bf12" https://api.smartthings.com/v1/apps

With result

{“items”:[{“appName”:“homeassistant.c603a1fc-481c-4a79-b814-7f5a91ff7429”,“appId”:“88277542-a20f-49ad-a4d2-9251eec031d6”,“appType”:“WEBHOOK_SMART_APP”,“classifications”:[“AUTOMATION”],“displayName”:“Home Assistant”,“description”:“Home Assistant at https://swallowmead.duckdns.org:8123”,“iconImage”:{},“createdDate”:“2019-02-18T18:32:24Z”,“lastUpdatedDate”:“2019-02-18T18:32:26Z”}],“_links”:{}}

Now when I run It I get the following:

{“items”:,“_links”:{}}

However I do still get the entry at the TOP of my smartapps page. I have tried restarting the classic app and rebooting the ST box.

Thanks for help.

You might want to remove your Bearer token above (if you haven’t already). At minimum i would delete that token if you haven’t already…it could allow for access into your account you don’t wish people to have. Never post your tokens publicly. Just some friendly advice. :slight_smile:

Thanks for advise and appreciated. It was removed. I did a screen grab of result.