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

Samsung purposefully broke SmartThings integration on Dec 30 #133623

Open
NewsGuyTor opened this issue Dec 19, 2024 · 241 comments
Open

Samsung purposefully broke SmartThings integration on Dec 30 #133623

NewsGuyTor opened this issue Dec 19, 2024 · 241 comments

Comments

@NewsGuyTor
Copy link

The problem

https://community.smartthings.com/t/changes-to-personal-access-tokens-pat/292019

TLDR: Newly generated PATs will only work for 24 hours, which will be absurdly annoying for new users of this integration, so a change to OAuth auth is needed ASAP.

What version of Home Assistant Core has the issue?

NA

What was the last working version of Home Assistant Core?

NA

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@NewsGuyTor NewsGuyTor changed the title Samsung will limit PATs to 24h on Dec 30 2024, breaking SmartThings Samsung will limit PATs to 24h on Dec 30 2024, breaking SmartThings integration Dec 19, 2024
@home-assistant
Copy link

@dengi76
Copy link

dengi76 commented Dec 29, 2024

Hello. I confirm the above! Today my token stopped working, I created a new one and when registering access (on the Samsung website) a notification appeared that access was created for an hour! What should I do?
Thank you!

@CarnsJalone
Copy link

This aligns with what I am seeing. Currently popping open the smartthings component to take a peek at the implementation. Does anyone know of another component that uses oauth 2.0 I can draw architectural reference from?

@joostlek
Copy link
Member

joostlek commented Jan 3, 2025

I'm trying to look into this but it doesn't look like we can use our normal oauth flow.

@ice3m
Copy link

ice3m commented Jan 4, 2025

Whew who ever gets SmartThings to stop giving me rate limits and doesn't make me get a new PAT every 24 hours will be my hero.

Sure you guys have seen it but here's their documentation on the OAuth flow:

https://developer.smartthings.com/docs/connected-services/oauth-integrations

@ozcet
Copy link

ozcet commented Jan 5, 2025

I am an old user of PAT. I restored from backup with mandatory new PAT. Now all my ST integration expired after 24 hours. Any progress for OAuth developement?

@dejatesting2
Copy link

Any word on the OAuth ? Half of my automations break every day due to an invalid token issue

@NewsGuyTor
Copy link
Author

Any word on the OAuth ? Half of my automations break every day due to an invalid token issue

I recommend you make a new thread here: https://community.smartthings.com/latest

@dejatesting2
Copy link

Any word on the OAuth ? Half of my automations break every day due to an invalid token issue

I recommend you make a new thread here: https://community.smartthings.com/latest

Why would I make a thread there? This is an issue with Home Assistant using PATs vs the OAuth method SmartThings wants people to use.... SmartThings has made the change and are not going back, this has to be changed on the home assistant integration side

@gemx
Copy link

gemx commented Jan 8, 2025

Also encountered this problem. Besides the short TTL i can only issue 1 commnd in 20 seconds due to rate limiting.
The integration is just not usable in this state.
Should we file a new ticket as feature request for the OAuth method?

@ozcet
Copy link

ozcet commented Jan 8, 2025

After PAT expire, HA get data only from read-only entities. I cannot execute actions. This is valid only If you do not restart HA. Temperature sensors values are correct. Strange !

@CarnsJalone
Copy link

So after a small bit of investigation, I believe (I am totally new to Home Assistant) that the underlying mechanism of control is the pysmartthings package and the specific method responsible for generating the token is located here.

If you look closely, the type of grant being used is basic (username + password --> very common in personal access token authentication). This is where my gut tells me the change would need to occur.

If my assumptions are correct, there's an additional problem, this repository has been archived on May 9, 2024. I don't know if there's an additional fork of this repository that is being supported.

@LiveMike78
Copy link

I wasn't aware of this and it coincided with me finally tidying up my SmartThings devices with the hass-smarthings-remove script. I thought I'd borked the integration by doing that. Subscribed to this thread to see when a solution drops. It's a major impact for me as my front door lock is connected via SmartThings to add redundancy (if I can't unlock with Home Assistant, I can fall back on SmartThings) but my family all use HA exclusively.

@daath
Copy link

daath commented Jan 11, 2025

Interested in seeing what the solution to this will be ...

@Jens-Wymeersch
Copy link

@joostlek 4% of the community are using this integration (and it is a key feature of NabuCasa). Is there any timeline to fix this problem ?

@NewsGuyTor NewsGuyTor changed the title Samsung will limit PATs to 24h on Dec 30 2024, breaking SmartThings integration Samsung purposefully broke SmartThings integration on Dec 30 Jan 11, 2025
@joostlek
Copy link
Member

Why would it be a key feature of nabu casa?

We're still looking into but trust me, it's difficult. I don't have any timeline as for now

@Jens-Wymeersch
Copy link

@joostlek one of the reasons why I'm using NabuCasa is because the integration with Amazon and Smartthings was made easy. And thank you for taking a crack at it !
Of course, I also wanted to support the home assistant project.

@NewsGuyTor
Copy link
Author

@Jens-Wymeersch I recommend moving away from Samsung products and SmartThings, they broke this on purpose despite having received plenty of warning.

@Jens-Wymeersch
Copy link

@NewsGuyTor we have in total 7 A/Cs - 6 of the 7 are controlled locally but one with smartthings. I'm not planning to replace these devices in the near future (cost is way too high).
I have one a/c left which needs to be replaced, might be thinking of another manufacturer for that one

@snok3r-krk
Copy link

For some reason, integration over PAT has been working for me for the last two or three days. I have not noticed any changes in the integration itself, and I was also unable to find any changes on Samsung's side (using community.smartthings). Any idea what is happening?

@Roukanken42
Copy link

Roukanken42 commented Jan 12, 2025

@snok3r-krk Interesting, I've just recreated a PAT to test this, and at least the very strict API limits are not there right now (was like 1 request / minute?). Will have to wait to see if it has longer TTL too, or if they just relaxed the limits.

@PrayerfulDrop
Copy link

ST reversed their decision temporarily for those with legacy PAT. All users who did not delete and create a new PAT should be good until HA fixes with OAUTH.

@Jens-Wymeersch
Copy link

@joostlek the call service is called climate.set_hvac_mode and data as indicated

{
"hvac_mode": "heat"
}

the other command should be something like climate.set_temperature and the data should be something like

{"temperature":68}

now in the last case, it should recognize the last mode and start it up like that

@joostlek
Copy link
Member

The commands we send to SmartThings work a bit differently, we have to pass stuff in a list to them rather than key: value

@joostlek
Copy link
Member

I just found out that air purifiers are seen as fans, so if you happen to have one of those feel free to help out :)

@Jens-Wymeersch
Copy link

@joostlek I understand but if I look at your log - which I'm not getting by the way. {'component': 'main', 'capability': <Capability.SWITCH: 'switch'>, 'command': <Command.ON: 'on'>}
it might be that the command needs to be set differently to get it working.

@joostlek
Copy link
Member

I have no clue why it doesn't show. But I know for sure that my actions work for my curtains and lights.

I am now syncing my codebase with the official documentation, after that I will take a look

@DavidSnider
Copy link

I've got thermostats for you. I'll run the directions today and get you the info.

@joostlek
Copy link
Member

Oh that is awesome! I could only test those via a virtual device so far, so in theory you should see every device like normal, but the test data is very much welcome :)

@DavidSnider
Copy link

Alright should be in your inbox. Hope this helps!

@joostlek
Copy link
Member

@Jens-Wymeersch How are you observing the logs by the way? Are you downloading them or seeing them in System -> Logs? Because in the latter, it doesn't show debug ones in the UI, only if you download the logs

@Jens-Wymeersch
Copy link

Jens-Wymeersch commented Feb 11, 2025

@joostlek I was looking in the UI. Thanks for the hint

Here are the logs from the custom integration for a change from 21 to 24C and change mode to heat → this didn't do anything
Then I manually turned on the A/C and turned it off → this turned off the A/C

2025-02-11 20:29:36.709 DEBUG (MainThread) [custom_components.smartthings.coordinator] Finished fetching [room a/c] Samsung data in 0.285 seconds (success: True)
2025-02-11 20:29:51.975 DEBUG (MainThread) [pysmartthings.smartthings] Executing command for device 96a5ef74-5832-a84b-f1f7-ca799957065d: {'component': 'main', 'capability': <Capability.THERMOSTAT_COOLING_SETPOINT: 'thermostatCoolingSetpoint'>, 'command': <Command.SET_COOLING_SETPOINT: 'setCoolingSetpoint'>, 'arguments': [24.0]}
2025-02-11 20:30:02.591 DEBUG (MainThread) [pysmartthings.smartthings] Executing command for device 96a5ef74-5832-a84b-f1f7-ca799957065d: {'component': 'main', 'capability': <Capability.AIR_CONDITIONER_MODE: 'airConditionerMode'>, 'command': <Command.SET_AIR_CONDITIONER_MODE: 'setAirConditionerMode'>, 'arguments': ['heat']}
2025-02-11 20:31:36.699 DEBUG (MainThread) [custom_components.smartthings.coordinator] Finished fetching [room a/c] Samsung data in 0.275 seconds (success: True)
2025-02-11 20:31:53.760 DEBUG (MainThread) [pysmartthings.smartthings] Executing command for device 96a5ef74-5832-a84b-f1f7-ca799957065d: {'component': 'main', 'capability': <Capability.THERMOSTAT_COOLING_SETPOINT: 'thermostatCoolingSetpoint'>, 'command': <Command.SET_COOLING_SETPOINT: 'setCoolingSetpoint'>, 'arguments': [24.0]}
2025-02-11 20:32:00.558 DEBUG (MainThread) [pysmartthings.smartthings] Executing command for device 96a5ef74-5832-a84b-f1f7-ca799957065d: {'component': 'main', 'capability': <Capability.AIR_CONDITIONER_MODE: 'airConditionerMode'>, 'command': <Command.SET_AIR_CONDITIONER_MODE: 'setAirConditionerMode'>, 'arguments': ['heat']}
2025-02-11 20:33:36.690 DEBUG (MainThread) [custom_components.smartthings.coordinator] Finished fetching [room a/c] Samsung data in 0.265 seconds (success: True)
2025-02-11 20:35:36.701 DEBUG (MainThread) [custom_components.smartthings.coordinator] Finished fetching [room a/c] Samsung data in 0.277 seconds (success: True)
2025-02-11 20:35:45.216 DEBUG (MainThread) [pysmartthings.smartthings] Executing command for device 96a5ef74-5832-a84b-f1f7-ca799957065d: {'component': 'main', 'capability': <Capability.SWITCH: 'switch'>, 'command': <Command.OFF: 'off'>}
2025-02-11 20:37:26.796 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from fe80::18eb:8600:863d:474 (fe80::18eb:8600:863d:474). Requested URL: '/auth/login_flow/cc1d3c20564f6a290e6320b68a551d29'. (Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:135.0) Gecko/20100101 Firefox/135.0)
2025-02-11 20:37:36.688 DEBUG (MainThread) [custom_components.smartthings.coordinator] Finished fetching [room a/c] Samsung data in 0.264 seconds (success: True)

I ran similar commands in the current integration (debug mode), here are the logs

2025-02-11 20:40:07.352 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '58d3fd7c-c512-4da3-b500-ef269382756c', 'device_id': '96a5ef74-5832-a84b-f1f7-ca799957065d', 'component_id': 'main', 'capability': 'switch', 'attribute': 'switch', 'value': 'on', 'data': {}}
2025-02-11 20:40:07.353 DEBUG (MainThread) [pysmartapp.smartapp] e45439f0-9419-12c9-dec0-50df1c1f27cc: EVENT received for installed app e1be9f9b-a5d6-4df2-8044-e14769474f2c.
2025-02-11 20:40:07.554 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '58d3fd7c-c512-4da3-b500-ef269382756c', 'device_id': '96a5ef74-5832-a84b-f1f7-ca799957065d', 'component_id': 'main', 'capability': 'thermostatCoolingSetpoint', 'attribute': 'coolingSetpoint', 'value': 23, 'data': {}}
2025-02-11 20:40:07.555 DEBUG (MainThread) [pysmartapp.smartapp] 473fab20-e2c4-7a27-3347-83302f0e555d: EVENT received for installed app e1be9f9b-a5d6-4df2-8044-e14769474f2c.
2025-02-11 20:40:07.565 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '58d3fd7c-c512-4da3-b500-ef269382756c', 'device_id': '96a5ef74-5832-a84b-f1f7-ca799957065d', 'component_id': 'main', 'capability': 'temperatureMeasurement', 'attribute': 'temperature', 'value': 21, 'data': {}}
2025-02-11 20:40:07.567 DEBUG (MainThread) [pysmartapp.smartapp] 473fab20-e2c4-7a27-3347-83302f0e555d: EVENT received for installed app e1be9f9b-a5d6-4df2-8044-e14769474f2c.
2025-02-11 20:40:09.291 WARNING (MainThread) [homeassistant.components.climate] Updating climate_ip climate took longer than the scheduled update interval 0:00:15
2025-02-11 20:40:14.710 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '58d3fd7c-c512-4da3-b500-ef269382756c', 'device_id': '96a5ef74-5832-a84b-f1f7-ca799957065d', 'component_id': 'main', 'capability': 'thermostatCoolingSetpoint', 'attribute': 'coolingSetpoint', 'value': 26, 'data': {}}
2025-02-11 20:40:14.712 DEBUG (MainThread) [pysmartapp.smartapp] 04e3e532-552d-2c54-6307-3fc844c2cf95: EVENT received for installed app e1be9f9b-a5d6-4df2-8044-e14769474f2c.
2025-02-11 20:40:22.223 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '58d3fd7c-c512-4da3-b500-ef269382756c', 'device_id': '96a5ef74-5832-a84b-f1f7-ca799957065d', 'component_id': 'main', 'capability': 'switch', 'attribute': 'switch', 'value': 'off', 'data': {}}
2025-02-11 20:40:22.223 DEBUG (MainThread) [pysmartapp.smartapp] a716d600-fe5b-afeb-c4af-504048b49337: EVENT received for installed app e1be9f9b-a5d6-4df2-8044-e14769474f2c.

@Jens-Wymeersch
Copy link

@joostlek I have both integrations now running simultaneously in 2 home assistant instances. So I can do any commands you want me to do and check the output. Let me know

@TA2k
Copy link

TA2k commented Feb 11, 2025

I created a new login flow for ioBroker maybe this relevant if Smartthings will not offer a new official way.

@Jens-Wymeersch
Copy link

@TA2k please send more info of how you are getting the ioBroker, SmartThings and home assistant working together

@joostlek
Copy link
Member

@Jens-Wymeersch Do you have Discord, maybe its easier to do this in a chat than here, since I believe everyone gets an email for every message here :)

@Jens-Wymeersch
Copy link

@joostlek agreed and sorry. The info I provided was what you were looking for ?

@joostlek
Copy link
Member

Yes, but let's continue in discord for now :)

@meckelangelo
Copy link

I have just sent you an email with my diagnostics and screenshots. I have two shades, which were treated as "covers" in the past. If you have already received enough of those, you may disregard the information from me. I also have a Frame TV, but I believe you have that covered already. Please let me know if there is anything I can help with!

Interestingly, I have a second PA token for the "SamsungTV Smart" HACS integration, which I use for additional control of my Frame TV. I have not had to renew the PA token for that integration. I don't understand why it would be different, so it definitely seems like the HA built-in integrations tokens are being specifically targeted to expire every 24 hours.

@joostlek
Copy link
Member

Tokens created before 30 december, not HA specifically

@meckelangelo
Copy link

meckelangelo commented Feb 11, 2025

All of my current tokens in ST were created after December 30th. The "SamsungTV Smart" token was actually my newest token when this problem cropped up for me in HA. My current "SamsungTV Smart" token is probably less than 10 days old.

@joostlek
Copy link
Member

I have no clue then, fwiw they have this enforced everywhere.

Thanks for the fixtures by the way :)

@joostlek
Copy link
Member

Currently the last thing I am looking for is test data for a fan/humidifier/air purifier, so if you happen to have one, lmk!

@joostlek
Copy link
Member

Aight, again, thanks for all the test data and responses from you all, it has been very helpful and it helped me a ton. Looking at the data, there's a lot of potential for features and neat stuff. So I just created a different Discord server so we can keep track of the data and devices, so we can make sure that if we implement a feature for for example a soundbar, that it works for all the users with a soundbar. So if you want to have even more features in the future (next to a working integration of course), join https://discord.gg/qEf4UWEq.

Also, Please don't run the script again to download the integration as a custom component. I now implemented OAuth and that seems to work. My next tasks is cleaning up the code, and preparing for the final piece.

I am still looking for the air purifier, so if you happen to have one, feel free to hmu!

@Audio-Lefty
Copy link

Is there any indication when version using oauth and replacing PAT will be released?
I am trying to avoid modifying over 100 automations and scripts. Reinstalling Smarthings, and other integrations that use Smarthings PAT id, everyday. Is not fun either.

@Jurgen-DOUCHY
Copy link

My gues I missed something.
But should we not focus on the oauth in the first place?
I'm sorry, did not read the last +100 messages.

@harvey251
Copy link

harvey251 commented Feb 13, 2025

My gues I missed something.
But should we not focus on the oauth in the first place?
I'm sorry, did not read the last +100 messages.

You should have read the first hundred rather than notifying everyone on the thread you couldn't be bothered.

I'm pretty sure it was said early the api changed from a key / value to a list or something to that effect.

@Jurgen-DOUCHY
Copy link

You should have read the first hundred rather than notifying everyone on the thread you couldn't be bothered.

@harvey251 didn't you drink your coffee yet bro?
Please keep your toxicity for facebook or something.

I'm pretty sure it was said early the api changed from a key / value to a list or something to that effect.
So, what does this means?

any way, here's another notification.

@harvey251
Copy link

You should have read the first hundred rather than notifying everyone on the thread you couldn't be bothered.

@harvey251 didn't you drink your coffee yet bro?
Please keep your toxicity for facebook or something.

I'm pretty sure it was said early the api changed from a key / value to a list or something to that effect.
So, what does this means?

any way, here's another notification.

@Jurgen-DOUCHY I've had coffee now ... basically it means that not only the authentication method has changed, but also how you interact with smart things. So I suspect a bigger job than you might initially expect.

@Audio-Lefty
Copy link

“Poor communications and inadequate notice to all interested parties about the change. This needs to be grandfathered with something like 3-6 months notice. Samsung should reverse the PAT change! Allow the community to transition on an orderly basis, anything less than this is shortsighted and interpreted as uncaring and undiplomatic.”
Who can we lobby???

Posted this at [Changes To Personal Access Tokens (PAT)]
https://community.smartthings.com/t/changes-to-personal-access-tokens-pat/292019

If a fix was easy it would be done already. Guys we have to make some noise

@MonoksideC
Copy link

MonoksideC commented Feb 13, 2025

If a fix was easy it would be done already. Guys we have to make some noise

The developer has been extremely active in this thread and a revamp of the integration to use oauth with refresh tokens as well as the different API, is nearly complete from the sound of it. I don't think trying to petition Samsung to change their token policy would be even worth thinking about at this point.

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