NabuCasa Smartthings integration died :(

I recently had to restore my HAOS & now my SmartThings integration seems to have died :sob: I cannot say for sure whether it was “broken” prior to the restoration of the HAOS earlier today or not, but it was all working last night. As it stands, all my lights & related sensors no longer interact nor show properly in the overview of HA.

Logger: homeassistant.config_entries
Source: components/smartthings/
First occurred: 4:41:49 pm (1 occurrences)
Last logged: 4:41:49 pm

Error setting up entry My home for smartthings
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/”, line 335, in async_setup
result = await component.async_setup_entry(hass, self)
File “/usr/src/homeassistant/homeassistant/components/smartthings/”, line 121, in async_setup_entry
token = await api.generate_tokens(
File “/usr/local/lib/python3.9/site-packages/pysmartthings/”, line 209, in generate_tokens
result = await self._service.generate_tokens(
File “/usr/local/lib/python3.9/site-packages/pysmartthings/”, line 424, in generate_tokens
raise APIInvalidGrant(data.get(“error_description”))
pysmartthings.errors.APIInvalidGrant: Invalid refresh token: xxxxxxxxxxx

It’s fair to say - I have no idea what that is, aside that I can see that there’s something it doesn’t like in the config (for smartthings, not yaml) and apparently an invalid token (which I’ve replaced with xxs just in case it’s considered sensitive). Is this just a case of NabuCasa needing to request a new token, and if so, how would one submit such a request? Or, is it a more in-depth problem requiring me to remove & reinstate add-ons, etc.? And if so, is there a current and working method (as I seem to only find content that is out of date when I try to do these things myself)?

Have you deleted the smarthings file within the hidden .storage directory and then restarted HA? Nabu Casa does not generate your token.

[quote=“cogneato, post:2, topic:412629, full:true”]
Have you deleted the smarthings file within the hidden .storage directory and then restarted HA?
[/quote] I don’t even know how to access any files as I’m running on a VM within a Synology NAS… so… no :frowning:
I shall investigate!

I have now done this - and nothing has changed.

I went in via terminal. I used “ls -a” to show all and navigated accordingly to: config/.storage and then used did “ls” to confirm it’s presence. Then I did, “rm smartthings”, and once more did “ls” to confirm it had been removed. It had. Then I rebooted HAOS as per your suggestion and the webhook toggle for SmartThings was ‘disabled’. I enabled it and it belched up the same errors as previous, leaving my lights & other devices still unusable :frowning:

Any other suggestions? :slight_smile:


I’ve since deleted the SmartThings integration from the Overview Dashboard/Lovelace and applied it as a new integration. I’ve renewed my SmartThings API and got a new key, which I applied to the now reinstalled/reintegrated SmartThings integration and after a reboot of HAOS, all my lights are back - whooooppeeeeee!

Cheers for the nudge in the right direction… Obviously there was a lot more to do aside from just removing that one file (which I didn’t even know existed) but it’s all done now - Thanks again!

I jumped the gun and assumed removing/ re-adding and getting a new key was part of the earlier process. Sorry for that. Removing the file is usually the step users forget (or don’t know about).

Not a problem :slight_smile:
I hadn’t touched anythinnnnnnnnnng for fear of breaking things further… But once I’d began the journey, I just kinda kept plodding on.

All done now though, thanks again :smiley:

Hi @KarlM & @cogneato, I got this same problem as KarIM did so I’d just like to confirm the order of the fix you implemented :slight_smile: : Did you first delete the smartthings file from the .storage directory and then reinstall/reintegrate the integration back? Or was it the other way around? I just want to be sure so I wont mess up my dozens of devices & entities coming from ST :fearful:


It was the order I’ve written it down as.

I removed the smartthings file from the hidden .storage folder and then deleted the integration.

Best of luck :slight_smile:

ps - mine’s done this exactly the same - again… Yay for stability!!!

1 Like

Thanks @KarlM, I did it the with same order and can confirm it works!

1 Like

I’m glad I could be of some assistance :smiley: