Get SmartThings access_token from config/.storage/core.config_entries

My setup: I have both integrations for SmartThings:

I like more the Climate IP integration as it works with my Samsung EHS heating pump, instead of Official SmartThings integration that lacks many features.

[Breaking News] Official SmartThings integration started working with OAuth tokens (refreshed automatically) from HA core version 2025.3.0!
This means the access_token is available somewhere in HA and (maybe?) can be used by Climate IP also, instead of setting it in configuration.yaml file.

I found that it is stored in config/.storage/core.config_entries, under same entry with the same ID and it is changed/refreshed regularly.
It looks like this:

{
	"created_at": "2025-03-05T18:53:59.335589+00:00",
	"data": {
		"auth_implementation": "cloud",
		"location_id": "abcdefgh-20aa-4065-b572-6acae74b68ba",
		"old_data": {
			"access_token": "abcdefgh-71fd-413a-a502-086648767ca3",
			"app_id": "abcdefgh-4645-4993-a502-46b45baecac4",
			"client_id": "abcdefgh-bfd3-432a-ad50-7c788cd3a654",
			"client_secret": "abcdefgh-ea4d-4773-8ec2-83e684d9586e",
			"installed_app_id": "abcdefgh-aebf-4da4-9f22-b3428c3802ac",
			"location_id": "abcdefgh-20aa-4065-b572-6acae74b68ba",
			"refresh_token": "abcdefgh-2d58-4139-b9cf-6cc79401627a"
		},
		"token": {
			"access_tier": 0,
			"access_token": "abcdefgh-49ea-4da0-b993-50a3bc4f069c",
			"expires_at": 1741417499.9367576,
			"expires_in": 86399,
			"installed_app_id": "abcdefgh-6840-4fd8-8107-a6a0ddab6c8b",
			"refresh_token": "abcdefgh-7ab7-4328-88e8-ddeb36a83ff1",
			"scope": "r:hubs:* r:locations:* r:rules:* r:scenes:* x:devices:* sse w:rules:* w:locations:* w:devices:* r:devices:* x:locations:* x:scenes:*",
			"service": "smartthings",
			"token_type": "bearer"
		}
	},
	"disabled_by": null,
	"discovery_keys": {},
	"domain": "smartthings",
	"entry_id": "01JNKTGMN74E2EH6JA5G8E184E",
	"minor_version": 1,
	"modified_at": "2025-03-07T07:05:01.170242+00:00",
	"options": {},
	"pref_disable_new_entities": false,
	"pref_disable_polling": false,
	"source": "user",
	"subentries": [],
	"title": "My home",
	"unique_id": "abcdefgh-20aa-4065-b572-6acae74b68ba",
	"version": 3
}

As we all know, Climate IP integration has since 2025 the token issue - it works only with PAT tokens from SmartThings account and it has to be issued and manually changed daily.

Is there a way to change the code to grab programmatically the working access_token that is available from official SmartThings integration in core.config_entries file?

I’ve experimented with manually getting the token from there and setting it in the configuration.yaml file.
And Climate IP works with it, instead of going to SmartThings website and generating a new PAT token each day…

What we need to get in the code is this information (mind the values below, they are just examples from my setup):

"token": { "access_token": "abcdefgh-49ea-4da0-b993-50a3bc4f069c"...

Calling it by the "entry_id": "01JNKTGMN74E2EH6JA5G8E184E"

I am not a skilled developer for this kind of job, just a newbie
Is somebody here that can fork the samsungrac code with this idea?
Requires installing also the SmartThings official integration

Thanks a lot!

The official smarthings integration switches to OAuth in 2025.3.x

Meaning it’s working a completely different way and even if you could. It’s not there anymore. Also what you’re describing is technically an authentication attack of a breed and part of why they switched…

The answer is for the developer of your custom integration to look at how the core integration is doing it now and copy thier auth method.

I know about the switch to OAuth in 2025.3.x for official SmartThings integration
I was asking if somebody around here with dev skills can get involved to do this workaround for Climate IP integration also. Not exactly to copy the auth code, at least to get the auth_token from config_entries. Official custom integration dev seems to be MIA…

Or at least guide me to some code example on how to get that info from config_entries, based on entry ID

I just proved that it works to get that token manually from core.config_entries (clear text file, json), paste it in Climate IP separate config file and it works, it gets the expected data.
Maybe the security issue is that SmartThings official integration exposes the access token in a clear text file? I have no issue with that as you need root to access it

That’s why i said technically… You have root so all bets are off.

Honestly I’d take what you did and go open a bug in the repo for the custom integration. That’d probably the fastest way to get it done?

Sure thing, Get SmartThings token from config/.storage/core.config_entries · Issue #128 · atxbyea/samsungrac · GitHub

1 Like

Yeah what Joostek did was able to do was awesome.

1 Like