Cloud component and Smartthings

For the record, I did follow the instructions.

I tried to install the removal utility and this happens:
~ $ pip install hass_smartthings_remove
bash: pip: command not found

From what I can make out, I may need to install Python before I can run pip commands. Is that correct and if Yes, how do I do this? I Googled and there are hundreds of ways of doing this it seems. I looked in the Add On store and could not see anything obvious.

For what its worth, I am using hassio and I do have this file in config/.storage/smartthings.

Sorry, like I said earlier Linux noob here but very very grateful for all help.

Sorry I dont think you can run pip in hass.io because you’re technically inside a docker container on the command line.

If you have access to a windows machine you should be able to install python on there to run the command. How To Install Python 3 on Windows {Quickstart}

Also check these instructions Installing Packages — Python Packaging User Guide

I know it’s painful but try not to give up :slight_smile:

Update - If that fails you can install the Smarrthings CLI (Command Line Interface Tool) available here. GitHub - SmartThingsCommunity/smartthings-cli: Command Line Interface (CLI) for the SmartThings APIs. Provides CRUD operations for platform artifacts as well as ability to control devices. There are versions for windows, MAC, and linux.

Run ‘smartthings apps’ to list the apps and ID’s. If any Homeassistant app shows, run
‘smartthings apps:delete [ID]’ replacing ID with the UUID or the number in the list

Thanks heaps. I will never give up while all you great guys help out.
I will try the Python from Windows first, if that fails, I’ll try second option and report back.

Again, thank you so much for helping.

1 Like

Update; I have installed Python3 on Windows 10 and ran the script with pip. Some errors:
C:\Users\llund\AppData\Local\Programs\Python\Python39>pip install hass_smartthings_remove
Collecting hass_smartthings_remove
Using cached hass_smartthings_remove-1.0.1-py3-none-any.whl (3.8 kB)
Collecting aiohttp==3.5.4
Using cached aiohttp-3.5.4-py3-none-any.whl
Collecting pysmartthings==0.6.3
Using cached pysmartthings-0.6.3-py3-none-any.whl (43 kB)
Collecting attrs>=17.3.0
Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Collecting multidict<5.0,>=4.0
Using cached multidict-4.7.6.tar.gz (50 kB)
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing wheel metadata … done
Collecting yarl<2.0,>=1.0
Using cached yarl-1.6.3-cp39-cp39-win_amd64.whl (125 kB)
Collecting chardet<4.0,>=2.0
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting async-timeout<4.0,>=3.0
Using cached async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting idna>=2.0
Using cached idna-3.2-py3-none-any.whl (59 kB)
Building wheels for collected packages: multidict
Building wheel for multidict (PEP 517) … error
ERROR: Command errored out with exit status 1:
command: ‘c:\users\llund\appdata\local\programs\python\python39\python.exe’ ‘c:\users\llund\appdata\local\programs\python\python39\lib\site-packages\pip_vendor\pep517\in_process_in_process.py’ build_wheel ‘C:\Users\llund\AppData\Local\Temp\tmpq3m9fb5b’
cwd: C:\Users\llund\AppData\Local\Temp\pip-install-wfmxw9ot\multidict_0e50a66841b444638ef203883447da05
Complete output (41 lines):


  • Accellerated build *

running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\multidict
copying multidict_abc.py → build\lib.win-amd64-3.9\multidict
copying multidict_compat.py → build\lib.win-amd64-3.9\multidict
copying multidict_multidict_base.py → build\lib.win-amd64-3.9\multidict
copying multidict_multidict_py.py → build\lib.win-amd64-3.9\multidict
copying multidict_init_.py → build\lib.win-amd64-3.9\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’
adding license file ‘LICENSE’
writing manifest file ‘multidict.egg-info\SOURCES.txt’
copying multidict_init_.pyi → build\lib.win-amd64-3.9\multidict
copying multidict_multidict.c → build\lib.win-amd64-3.9\multidict
copying multidict\py.typed → build\lib.win-amd64-3.9\multidict
creating build\lib.win-amd64-3.9\multidict_multilib
copying multidict_multilib\defs.h → build\lib.win-amd64-3.9\multidict_multilib
copying multidict_multilib\dict.h → build\lib.win-amd64-3.9\multidict_multilib
copying multidict_multilib\istr.h → build\lib.win-amd64-3.9\multidict_multilib
copying multidict_multilib\iter.h → build\lib.win-amd64-3.9\multidict_multilib
copying multidict_multilib\pair_list.h → build\lib.win-amd64-3.9\multidict_multilib
copying multidict_multilib\views.h → build\lib.win-amd64-3.9\multidict_multilib
running build_ext
building ‘multidict._multidict’ extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: Microsoft C++ Build Tools - Visual Studio

ERROR: Failed building wheel for multidict
Failed to build multidict
ERROR: Could not build wheels for multidict which use PEP 517 and cannot be installed directly

I Googled the ERROR: Failed building wheel for multidict message and other users report that the Microsoft Visual C++ 14.0 fixed the problem.
I went to Microsoft C++ Build Tools - Visual Studio and downloaded Visual Studio.
I haven’t installed it yet, I thought I would ask here first - is there any reason why I should NOT do this?

Apologies for the noob questions.

It appears based on the error c++ is a package dependency that you will need to install in the windows version. Try installing c++ and run the script again. C++ is a Microsoft product so it’s not like your installing an unknown program. You can always uninstall it later.

I installed Visual Studio and had some success:
C:\Users\llund\AppData\Local\Programs\Python\Python39>pip install hass_smartthings_remove
Collecting hass_smartthings_remove
Using cached hass_smartthings_remove-1.0.1-py3-none-any.whl (3.8 kB)
Collecting pysmartthings==0.6.3
Using cached pysmartthings-0.6.3-py3-none-any.whl (43 kB)
Collecting aiohttp==3.5.4
Using cached aiohttp-3.5.4-py3-none-any.whl
Collecting chardet<4.0,>=2.0
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting attrs>=17.3.0
Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Collecting yarl<2.0,>=1.0
Using cached yarl-1.6.3-cp39-cp39-win_amd64.whl (125 kB)
Collecting multidict<5.0,>=4.0
Using cached multidict-4.7.6.tar.gz (50 kB)
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing wheel metadata … done
Collecting async-timeout<4.0,>=3.0
Using cached async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting idna>=2.0
Using cached idna-3.2-py3-none-any.whl (59 kB)
Building wheels for collected packages: multidict
Building wheel for multidict (PEP 517) … done
Created wheel for multidict: filename=multidict-4.7.6-cp39-cp39-win_amd64.whl size=48660 sha256=158f18430a30feeefac7e1e55f64f8986d3ff09be502323e7f8ac41765857d19
Stored in directory: c:\users\llund\appdata\local\pip\cache\wheels\43\3a\a8\d7bf95ae763a7a2057cb502ff2da094763c166f253624afc63
Successfully built multidict
Installing collected packages: multidict, idna, yarl, chardet, attrs, async-timeout, aiohttp, pysmartthings, hass-smartthings-remove
Successfully installed aiohttp-3.5.4 async-timeout-3.0.1 attrs-21.2.0 chardet-3.0.4 hass-smartthings-remove-1.0.1 idna-3.2 multidict-4.7.6 pysmartthings-0.6.3 yarl-1.6.3

So if I am correct, my next step should be:
hass_smartthings_remove PERSONAL_ACCESS_TOKEN
With PERSONAL_ACCESS_TOKEN looking something like this abcdefg-xxxx-yyyy-zzzz-abcdefghijkl

Does this sound right?

I really appreciate your patience with this.

If you are using hassos or supervised, I managed to install hass_smartthings_remove with pip.

pip install multidict==4.5
pip install hass_smartthings_remove

By the way, this is bollocks.

I don’t run hassos and use home assistant container, so admittedly don’t know everything on that. A forum search with various posts advised of difficulties with pip installs with hass.io Search results for 'Run pip' - Home Assistant Community so I was attempting to advise the OP of alternative ways they could install the removal tool. Apologies if I provided wrong info here.

Your method of running just two commands to install it will be much easier though.

1 Like

I run hassos and I can’t find a way to get pip to run. If there is a way, I would appreciate advice on how to install it. As mentioned above, just running the two commands would make it so much simpler.

In any case, am I good to do the below?

hass_smartthings_remove PERSONAL_ACCESS_TOKEN
With PERSONAL_ACCESS_TOKEN looking something like this abcdefg-xxxx-yyyy-zzzz-abcdefghijkl

Apologies for doing this the long slow one-step-at-a-time, I just want to make sure I don’t make things worse by doing the wrong thing.

Appreciate the help.

Install the ssh and web terminal addon.

I have installed Terminal & SSH addon.
This is what happens when I open the Terminal & SSH Web UI and try to run the command:

~ $ pip install multidict==4.5
bash: pip: command not found

I’m not sure what’s going on with the PIP command and hassos. I’ve seen lots of posts throughout this forum though of people having problems with running PIP commands or some issue and then someone responds just pasting instructions from the documentation saying “just follow the instructions”. I will definitely say the Home Assistant documentation is very well maintained, a great starting point, and a 1000 times better then Smartthings documentation (or lack thereof), but when you run into problems like the ones you’re experiencing it’s easy to get stuck and need more help. To avoid these types of responses honestly how I would start any post for help is “I followed the documentation at this link (paste link to documentation) and I did xyz and got stuck at step whatever” and that should hopefully avoid a response with just a link to the documentation.

Hassos is great, especially for people starting out, and makes things easier when everything works, but it is a sandboxed and locked down version of linux that makes simple things like running a PIP command out of the box or installing a package difficult. This is why I run Home Assistant container on Ubuntu - it’s more difficult to get going at first but I have a lot more control over the OS, installing other programs, running any linux commands, and a program install outside of of an add on is possible and as simple as running an apt install command. So when I advised “I don’t think you can run PIP in hassos” I was simply saying that command doesn’t work out of the box (as you yourself have noticed). If someone else says you can run the command and I don’t know what I’m talking about hopefully they can explain what extra steps are needed to be able to run a PIP command so you can run it in the future. However, those extra steps definitely aren’t in the documentation for the removal tool anywhere.

To get back to your question, once you get the removal tool installed whatever way works for you, you will run that hass_smartthings_remove command with the Smartthings access token you generated at this link. Samsung account . That should clear the orphaned smartapp out of Smartthings and let you start over with installing the Smarthings integration fresh. For a totally fresh start after deleting that app make sure you follow the guidance in this post and delete any residual files from the integration’s attempted install on the Home Assistant side as well Cloud component and Smartthings - #19 by Nameless . Good luck and hopefully this can get you up and running.

Thanks, much appreciated.
I ran the command from the Windows box and got this:

C:\Users\llund\AppData\Local\Programs\Python\Python39>hass_smartthings_remove [32 characters]
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000018043189160>
Traceback (most recent call last):
File “c:\users\llund\appdata\local\programs\python\python39\lib\asyncio\proactor_events.py”, line 116, in del
self.close()
File “c:\users\llund\appdata\local\programs\python\python39\lib\asyncio\proactor_events.py”, line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File “c:\users\llund\appdata\local\programs\python\python39\lib\asyncio\base_events.py”, line 746, in call_soon
self._check_closed()
File “c:\users\llund\appdata\local\programs\python\python39\lib\asyncio\base_events.py”, line 510, in _check_closed
raise RuntimeError(‘Event loop is closed’)
RuntimeError: Event loop is closed

Does this seem right?

I deleted the config/.storage/smartthings file.

No the removal tool didn’t work. The response you should get is

Removed installed app 'Home Assistant'
Removed app 'homeassistant'

Or just nothing if no app was there. You’re getting some sort of runtime error.

If you can access a machine running a real version of linux it literally is as easy as just running the two commands to install the tool and remove the app. Hopefully someone else can post more info on getting PIP to work with Hass.io. I don’t have experience trying to run Python on windows and was hoping the guides would get you to where you need to go, but unfortunately it doesn’t look like its working.

You can try installing the integration again with the steps you’ve already taken to try but I’m not sure it will work. If not you’ll need to run that removal tool.

I do have a box running Ubuntu 20.4 and I had to install PIP, no problems.

I ran the scrips and the last script returned nothing so perhaps that means that there was nothing to remove.

Does that mean I am good to try the integration again starting fresh with a new token?

PS. When I log in to my Smartthings account, there is a Delete option. Should I use that?

Yes, very good. No error confirms it was removed or not there. Likely not there if it didn’t say anything but it’s possible your other attempt removed it and errored out before conformation.

Either way try to install again following the guide and let us know if/where you get stuck.

No you will be asked for that token when you attempt to add the integration again.

Update, this is what I did as per the instructions:

  1. Logged in to Smartthings account, Personal access tokens
  2. Clicked on Generate new token
  3. Entered name Home Assistant token
  4. Selected Devices (all), Installed Applications (all), Apps (all), Locations (all), Scenes (all), Schedules (all)
    New token generated: 867da8a1-f24b-47c7-927f-91c6f0925f83
  5. Webhook already existed in Home Assistant Cloud, Webhooks
  6. Clicked Configuration, I get a pop-up that never finishes:
    image

Try contacting nabu casa support Support

Thanks, I logged a case with Nabu Casa and attached the log file.

Hoping for good news, I will post back here if there are any news.

1 Like

Update:

Some things have changed since yesterday; I had a power outage so the Raspberry PI which Home Assistant resides on ended up being restarted.

And now I have just managed to work through the steps and the integration seems to work (I think anyway and I had a Success! message and I can see the Smartthings tile so hopefully all good.

Perhaps a restart was all that was needed? I should have tried that earlier…

In any case, thank you all very very much for all the help you have given me.

Now for the Google Assistant integration…

2 Likes