Smarthings Integration

So, I had this all working swimmingly when the ip based api hooks worked. Then it stopped working when the ip access was shut down (and the subscription approach was taken, I get it I guess). So I let this sit for several months while I just stuck with Smartthings. I’m looking now to get it up and running again and I’m having a ton of frustration.

I’ve setup my nabu/cloud account. I’ve connected it and it works fine for remote HA access/management. I now need to connect my smartthings hub back to the system and I’m having zero luck.

In the instructions there’s this section:

  1. From Home Assistant, navigate to ‘Configuration’ then ‘Integrations’. Click the plus icon and type/select ‘SmartThings’.
  2. Confirm the callback URL is correct. If using Home Assistant Cloud it will start with https://hooks.nabuca.casa . If the URL is not correct, update your Home Assistant configuration, restart, and try again.

…here’s the problem. When loading the connector for ST it shows the old IP based link and the dialog says the above (if the URL is not correct, update your HA…etc etc.) Ok, that’s great but there’s zero instructions on how to do that. Why for heavens sake doesn’t this dialog let you change the URL/token directly? Am I supposed to find some hidden configuration files to remove the bad url (that used to be the good url) so I can then update it? Where’s the instructions on how to “update” it to the correct one?

I realize I sound like I’m ranting here or under appreciative of the work that went into HA but it is frustrating when time isn’t spent to make steps like these less obscure.

It took a day of fiddling but I managed to integrate my Smarthings hub and my HA. But this only work one way… if I turn on a Z-wave light in the Smartthings App (or at the wall) HA does not change its state… But if I change the Z-wave light switch with HA then Smarthings correctly reports the lights status…

Does anyone else have this problem? Is this normal? How do you fix it?

How do you set this up now that the old Smarthings app no longer works?

Follow the steps from the docs.

The steps on the site documentation makes no sense at all. This has been working for a couple of years, now I find the app that Samsung provide no longer works.

Add your location in the SmartThings app.

In the new Samsung app the location is certainly there, but still not recognised.

Did you authorize the location scopes when you generated the token?

BTW thanks for your help! Yes, the token is quite old and I authorised everything. With the old app you had to add the “Home Assistant” App, but the new App does not have such a function.

because it’s not used anymore, I’d recreate the token if this is the error you’re getting still.

Actually I just did that, still the same story…

double check your home assistant log see if there’s more info there

This is what I have, There must be something to do on the Smartthings side…

Logger: homeassistant.config_entries
Source: components/smartthings/__init__.py:121 
First occurred: 3:36:05 PM (1 occurrences) 
Last logged: 3:36:05 PM

Error setting up entry My home for smartthings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 234, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/smartthings/__init__.py", line 121, in async_setup_entry
    token = await api.generate_tokens(
  File "/usr/local/lib/python3.8/site-packages/pysmartthings/smartthings.py", line 209, in generate_tokens
    result = await self._service.generate_tokens(
  File "/usr/local/lib/python3.8/site-packages/pysmartthings/api.py", line 424, in generate_tokens
    raise APIInvalidGrant(data.get("error_description"))
pysmartthings.errors.APIInvalidGrant: Invalid refresh token: xxxxxxx-aaba-4502-a714-cc137xxxxxx

I think i had this once, check in .storage for a file called smartthings and rename it to smartthings.bak then try again. I think I had to restart HA after renaming I don’t recall.

1 Like

No such file, however I fixed it. In the end just deleted the integration and re-added it, then I got the link to the Samsung web site to authorise from the Samsung end. I used a new API key too just for belt and braces.

Many thanks for your help @firstof9 You certainly got me thinking and helped me to the final fix.

1 Like

Happy to help! Enjoy!

I tried to follow the instructions in this link https://www.home-assistant.io/integrations/smartthings/ but it does not really specify where i need to add the Personal access token. I am new to homeassistant (30 minutes) into it. Any help is greatly appreciated.

It should give you that option when you first add the SmartThings integration. (navigate to ‘Configuration’ then ‘Integrations’. Click the plus icon and type/select ‘SmartThings’.) If you missed that option, I don’t actually see an “options” selection on my installed integration so you may have to uninstall it and reinstall it. Then you should see the option to put in your callback URL, Personal Access Token, login to your SmartThings account, etc.

The first thing i get is webhook invalid message. Does not even go to the next level when i need to enter the details. I am reinstalling the whole homeassistant from scratch again.

I did the port forward and am able to access outside of my network. I did duckdns setup and also nginix setup as well. Not sure what i am missing.

This is the error message I am getting

Aborted

Home Assistant is not configured correctly to receive updates from SmartThings. The webhook URL is invalid:

Your external URL isn’t valid, you need either a static IP or an FQDN from a service like DynDNS or DuckDNS first.