Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SmartThings integrations broken after upgrade to 2025.1.0 #134945

Closed
eclizotte opened this issue Jan 7, 2025 · 27 comments
Closed

SmartThings integrations broken after upgrade to 2025.1.0 #134945

eclizotte opened this issue Jan 7, 2025 · 27 comments

Comments

@eclizotte
Copy link

The problem

Smartthings integratons Failed to Set up - been running fine for years.

What version of Home Assistant Core has the issue?

2025.1.0

What was the last working version of Home Assistant Core?

2024.12

What type of installation are you running?

Home Assistant OS

Integration causing the issue

official SmartThings

Link to integration documentation on our website

https://www.home-assistant.io/integrations/smartthings/

Diagnostics information

home-assistant_smartthings_2025-01-07T03-01-45.450Z.log
home-assistant_smartthings_2025-01-07T02-33-25.078Z.log
home-assistant_smartthings_2025-01-07T01-46-02.211Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2025-01-06 21:59:35.747 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Cottage for smartthings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/smartthings/__init__.py", line 129, in async_setup_entry
    token = await api.generate_tokens(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/smartthings.py", line 209, in generate_tokens
    result = await self._service.generate_tokens(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        client_id, client_secret, refresh_token
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/pysmartthings/api.py", line 424, in generate_tokens
    raise APIInvalidGrant(data.get("error_description"))
pysmartthings.errors.APIInvalidGrant: Invalid refresh token requested by clientId: a226dc49-8816-49eb-b775-d1daeefcf47a with grantType: refresh_token, e.cause: no cause

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Jan 7, 2025

@eclizotte
Copy link
Author

I deleted and re-added it and it appears to come back, lets see if it stays.

@vantech14
Copy link

I can add that rebooting home assistant causes the integration to break, however it then shows as an “available integration”.

You have to re-auth with a brand new token to fix.

Subsequent reboots replicates the same issue.

@skurian25
Copy link

skurian25 commented Jan 7, 2025

Hi, might this be related to #133623 ?
EDIT: Smartthings "OAuth access tokens expire 24 hours from the time they are generated." (this is an update for any new token after 2024-12-24)

@molodoy6260
Copy link

after the update to 2025.1 every day you have to generate a new token

@eclizotte
Copy link
Author

after the update to 2025.1 every day you have to generate a new token

I'm using the same token since 2023, this is not a new token.

@cbrinks17
Copy link

after the update to 2025.1 every day you have to generate a new token

I'm using the same token since 2023, this is not a new token.

Samsung made a change that only affects new tokens created after December 30th, 2024.

If you are unlucky and had to restore a backup after that, you are out of luck.

@LazyLizardJago
Copy link

LazyLizardJago commented Jan 7, 2025

I have a similat issue as I can go through all installation steps and it says config successsfully created but it also has error message at same time. (Integration could not be loaded. Please try to restart HA) But restart does not help in any way.
HA core is on version 2025.1.1

@matt0020190
Copy link

matt0020190 commented Jan 7, 2025

Same issue here, I reverted to HA 2024.12.5 and all working again.

In 2025.1.0 the integration stops working as stated by the OP. Didn't want to delete and re-add as means potentially updating my automation entities again

@vantech14
Copy link

Has there been any movement on this? The token needs to be recreated every 24 hours which is slightly annoying.

@Schmider112
Copy link

same issue here. very disappointing

@PedroArkanson
Copy link

Who will take up the issue? Is a solution being worked on?

To be honest, I’m surprised that this topic has such a low priority and that there is hardly any feedback on it, even though 4.7% of active installations use Smartthings.

Does anyone know what will happen here in the future?

@Tobias712
Copy link

I have the same issue and would really be thankfull if this could be fixed

@dettofatto
Copy link

I have the same issue...

@Joshbloam
Copy link

I have the same issue

@jpvanhulst
Copy link

I have same issue :-(

@Denox78
Copy link

Denox78 commented Jan 11, 2025

Hi everyone,

Could someone confirm if the issue is linked to the changes Samsung made regarding the token expiring after 24H? Or is it more related to the latest 2025 version of HA OS?

I’m asking because someone mentioned having an old token and experiencing the same problem.

Can anyone else confirm encountering the issue with an old token?

@matt0020190
Copy link

matt0020190 commented Jan 11, 2025

I think it's a separate issue. When the integration stopped working, I rolled HA back and all fine again.
I've waited and a new Smartthings integration update was issued yesterday. I updated HA to the latest version and issue fixed thereafter.
I didn't do anything else including removing the integration. Therefore I'd suggest the token problem is unrelated to the 2025.1.2 update which happened to break the integration as per the OP

@matt0020190
Copy link

after the update to 2025.1 every day you have to generate a new token

I'm using the same token since 2023, this is not a new token.

Samsung made a change that only affects new tokens created after December 30th, 2024.

If you are unlucky and had to restore a backup after that, you are out of luck.

Worth adding that this seems to be why the token problem is caused. If you tried to fix the issue with Smartthings and the new version of HA in 2025.1.x, you might have created a new token after 30.12.24 which now expire every 24h. Therefore you may be out of luck as suggested.
Sometimes it's worth sitting tight and opposed to reinstalling integrations, wait for updates after a new version of HA breaks them

@Jens-Wymeersch
Copy link

I have the same issue with the token. Not sure how to address it with samsung though.

@Jurgen-DOUCHY
Copy link

Also have this problem. It's very annoying.
It looks like the config is not persistant?

@rbaptista1995
Copy link

I have the same issue version 2025.1.2 and work fine but i need to reconfigure smartthings everytime that i need reboot hass

@Jens-Wymeersch
Copy link

duplicate #133623

@maggeoak
Copy link

Same issue here. Grrr

@davefromcamp
Copy link

@joostlek
Copy link
Member

So Samsung decided to make PATs created after 30 December 2024 to not last longer than 24 hours.

If you never created a PAT before then

You're out of luck. For now. We are working with Samsung to make we can allow new users again.

If you did use to run HA with SmartThings before that date

The update to 2025.1.0 for some reason caused integration to remove itself. I opened a PR (#135673) to instead of removing itself, ask the user for a reauth. This way you don't lose your old PAT (which still work like normal).

Did you have the situation where SmartThings removed itself and you used a PAT from before 30 december 2024 in Home Assistant before? Check your backups! To ease this I have written a script for you to help that process.

So there are 2 ways to check your data, it depends on how you manage your backups. You need to use a Linux terminal for this. I am sure that there are people who have trouble with this, I don't have the room to help every single one, so please use the forums and discord and help each other where you can :)

I have manual backups from before 30 December 2024

Great. So now we need to extract the data from that backup. I have good news and bad news. Good news, that is perfectly doable, bad news, it's a chore to find which backup it is. In the script I added fallbacks to make sure we got the right backup.

I think the easiest way for the majority of users is this way. You could of course download the backup and do it on your PC, but the tools in the bashscript are not available on Windows, so that would be another difficulty. I also tried downloading the backup and uploading it again, I literally could not achieve this. So yes, there are a million better ways to achieve this, but since the amount of people is a small minority, I can't really make it water proof (like, I'd rather spend my time on fixing the rest).

Step 1: Download the script

So you do that in the terminal add-on:

cd /backup
wget https://gist.githubusercontent.com/joostlek/05ee552ed5a6360ae7049cdf2dd712a5/raw/smartthings.sh
chmod +x smartthings.sh

[!WARNING]
Always check bash files before plainly downloading them and running them if they are provided by strangers.

Step 2: Find the backup

ls -lath | head -n 15

This will show the 15 latest backups. This can be a mix of addon backups and Home Assistant Backups. For me the Home Assistant backups were the biggest (compared to the addon ones).

Note down this filename, as you need it in the following script.

Are you not sure you picked the right one? The script will tell you the date to make sure before extracting.

Step 3: Extract it from the backup

Depending on the size of your backup. This can take a little while. Mine was about 800MB and it took a minute or 2. My Terminal addon even asked me to reconnect a few times. Don't worry about that. Be aware that when you run the script you need to confirm you have the right backup (to avoid we don't run the wrong backup multiple times).

./smartthings.sh -b 0ab1c2.tar

Like said, it will ask you to confirm this is the right backup. If it can't find the api key, it will say so, and if it finds one, it will display it.

I have a copy of my Home Assistant config folder somewhere

Great, maybe you have some external backup. Also built support for that. Please follow step 1 like before and then execute:

./smartthings.sh -c /path/to/config

This will do the same check and result back if you have one.

Some caveats

I am a new user with a token after 30 december 2024

You're out of luck. Stay tuned as we will be working hard on this 💪🏻

Because I was tinkering with this, I deleted my old PAT from the Samsung portal

In that case you don't have any valid PAT left and you're also out of luck.

I will close this issue, because its a duplicate of #133623

@Gorgue
Copy link

Gorgue commented Jan 16, 2025

So Samsung decided to make PATs created after 30 December 2024 to not last longer than 24 hours.

If you never created a PAT before then

You're out of luck. For now. We are working with Samsung to make we can allow new users again.

If you did use to run HA with SmartThings before that date

The update to 2025.1.0 for some reason caused integration to remove itself. I opened a PR (#135673) to instead of removing itself, ask the user for a reauth. This way you don't lose your old PAT (which still work like normal).

Did you have the situation where SmartThings removed itself and you used a PAT from before 30 december 2024 in Home Assistant before? Check your backups! To ease this I have written a script for you to help that process.

So there are 2 ways to check your data, it depends on how you manage your backups. You need to use a Linux terminal for this. I am sure that there are people who have trouble with this, I don't have the room to help every single one, so please use the forums and discord and help each other where you can :)

I have manual backups from before 30 December 2024

Great. So now we need to extract the data from that backup. I have good news and bad news. Good news, that is perfectly doable, bad news, it's a chore to find which backup it is. In the script I added fallbacks to make sure we got the right backup.

I think the easiest way for the majority of users is this way. You could of course download the backup and do it on your PC, but the tools in the bashscript are not available on Windows, so that would be another difficulty. I also tried downloading the backup and uploading it again, I literally could not achieve this. So yes, there are a million better ways to achieve this, but since the amount of people is a small minority, I can't really make it water proof (like, I'd rather spend my time on fixing the rest).

Step 1: Download the script

So you do that in the terminal add-on:

cd /backup
wget https://gist.githubusercontent.com/joostlek/05ee552ed5a6360ae7049cdf2dd712a5/raw/smartthings.sh
chmod +x smartthings.sh
[!WARNING] Always check bash files before plainly downloading them and running them if they are provided by strangers.

Step 2: Find the backup

ls -lath | head -n 15
This will show the 15 latest backups. This can be a mix of addon backups and Home Assistant Backups. For me the Home Assistant backups were the biggest (compared to the addon ones).

Note down this filename, as you need it in the following script.

Are you not sure you picked the right one? The script will tell you the date to make sure before extracting.

Step 3: Extract it from the backup

Depending on the size of your backup. This can take a little while. Mine was about 800MB and it took a minute or 2. My Terminal addon even asked me to reconnect a few times. Don't worry about that. Be aware that when you run the script you need to confirm you have the right backup (to avoid we don't run the wrong backup multiple times).

./smartthings.sh -b 0ab1c2.tar
Like said, it will ask you to confirm this is the right backup. If it can't find the api key, it will say so, and if it finds one, it will display it.

I have a copy of my Home Assistant config folder somewhere

Great, maybe you have some external backup. Also built support for that. Please follow step 1 like before and then execute:

./smartthings.sh -c /path/to/config
This will do the same check and result back if you have one.

Some caveats

I am a new user with a token after 30 december 2024

You're out of luck. Stay tuned as we will be working hard on this 💪🏻

Because I was tinkering with this, I deleted my old PAT from the Samsung portal

In that case you don't have any valid PAT left and you're also out of luck.

I will close this issue, because its a duplicate of #133623

This solution worked for me, I was lucky and created the token on December 1st. In my case Home Assistant did not disable the integration, once I located the configuration in the backups, I deleted it, and recreated it with the same token and everything worked again. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests