#SmartThings Incorrectly Controlling Thermostat

1 messages · Page 1 of 1 (latest)

hollow dove
#

Not sure when this started but the SmartThings add-on is incorrectly controlling the thermostat on 2025.5.3. If I have the thermostat in auto mode (heat/cool) with a heat to 70 set point and a cool to 74 set point, if I use the UI to drop the "cool to" to 73, the thermostat will momentarily show 70/73 and then all of a sudden switch to 68/70. If its 68/74 and I set to 68/73, it actually updates to 66/68.

I've tried removing and re-adding the integration and restarting the thermostat. Neither seem to correctly control the thermostat. That pattern seems to be that both the hot/cold are -2 from the heat point with the cool point now the new heat point (if that makes sense).

Downgrading to 2025.5.1 didn't resolve the issue completely but it seems to at least be "sort of" correct. The cool point setting works but the heat doesn't. Overall the controls just seem all over the place.

hollow dove
#

Manually testing the pysmarthings seems to work so not sure where there is a disconnect. This correctly set the temp to 72 but I know there was a smartthings overhaul recently:

pipenv run python -c "
import asyncio
import aiohttp
import pysmartthings
import os
from dotenv import load_dotenv

load_dotenv()

async def set_cooling():
    token = os.getenv('SMARTTHINGS_TOKEN')
    
    async with aiohttp.ClientSession() as session:
        api = pysmartthings.SmartThings(_token=token, session=session)
        
        try:
            devices = await api.get_devices()
            thermostat = devices[0]
            
            print(f'Found thermostat: {thermostat.label}')
            
            # Try matching the HA format exactly
            print('Setting cooling setpoint to 72°F...')
            result = await api.execute_device_command(
                thermostat.device_id,
                pysmartthings.Capability.THERMOSTAT_COOLING_SETPOINT,
                pysmartthings.Command.SET_COOLING_SETPOINT,
                'main',
                argument=round(72, 3)
            )
            print(f'Result: {result}')
            print('Done!')
            
        except Exception as e:
            print(f'Error: {e}')

asyncio.run(set_cooling())
"
naive crescent
#

Please enable debug logging, and try to annotate the logs you get with the actions you do

hollow dove
#

Will do - I did create this quick gif showing what happens. I had the SmartThings app open on my phone and then used the web interface to change the temp and record. Its not perfectly synced but shows the steps.

#
2025-06-09 10:23:53.636 DEBUG (MainThread) [pysmartthings] Executing command for device 2409a73c-918a-4d1f-b4f5-c27468c71d70: {'component': 'main', 'capability': <Capability.THERMOSTAT_HEATING_SETPOINT: 'thermostatHeatingSetpoint'>, 'command': <Command.SET_HEATING_SETPOINT: 'setHeatingSetpoint'>, 'arguments': [68.0]}
2025-06-09 10:23:53.637 DEBUG (MainThread) [pysmartthings] Executing command for device 2409a73c-918a-4d1f-b4f5-c27468c71d70: {'component': 'main', 'capability': <Capability.THERMOSTAT_COOLING_SETPOINT: 'thermostatCoolingSetpoint'>, 'command': <Command.SET_COOLING_SETPOINT: 'setCoolingSetpoint'>, 'arguments': [71.0]}
2025-06-09 10:23:54.832 DEBUG (MainThread) [pysmartthings] Command response: {"results":[{"id":"6af9cc6c-aa1b-4ac8-8eb6-f3d7adc8f2ff","status":"ACCEPTED"}]}
2025-06-09 10:23:54.843 DEBUG (MainThread) [pysmartthings] Command response: {"results":[{"id":"8a08b264-6bd1-47c5-8a2d-fefb9069cc22","status":"ACCEPTED"}]}
2025-06-09 10:23:54.893 DEBUG (MainThread) [pysmartthings] Received event: {"eventTime":1749486234795,"eventType":"DEVICE_EVENT","deviceEvent":{"eventId":"232617cf-454e-11f0-99f5-31d15a8dc3db","locationId":"fc2fb744-4d34-4276-be33-56bbc6af266e","ownerId":"fc2fb744-4d34-4276-be33-56bbc6af266e","ownerType":"LOCATION","deviceId":"2409a73c-918a-4d1f-b4f5-c27468c71d70","componentId":"main","capability":"thermostatCoolingSetpoint","attribute":"coolingSetpoint","value":71,"valueType":"number","unit":"F","stateChange":true,"data":{},"subscriptionName":"My Home Assistant sub","commandId":"","sensitive":false}}
2025-06-09 10:24:00.950 DEBUG (MainThread) [pysmartthings] Received event: welcome
2025-06-09 10:24:02.621 DEBUG (MainThread) [pysmartthings] Received event: {"eventTime":1749486242538,"eventType":"DEVICE_EVENT","deviceEvent":{"eventId":"27c394c8-454e-11f0-b325-5d5564bf1803","locationId":"fc2fb744-4d34-4276-be33-56bbc6af266e","ownerId":"fc2fb744-4d34-4276-be33-56bbc6af266e","ownerType":"LOCATION","deviceId":"2409a73c-918a-4d1f-b4f5-c27468c71d70","componentId":"main","capability":"thermostatCoolingSetpoint","attribute":"coolingSetpoint","value":68,"valueType":"number","unit":"F","stateChange":true,"data":{},"subscriptionName":"My Home Assistant sub","commandId":"","sensitive":false}}
2025-06-09 10:24:02.643 DEBUG (MainThread) [pysmartthings] Received event: {"eventTime":1749486242539,"eventType":"DEVICE_EVENT","deviceEvent":{"eventId":"27c3bc75-454e-11f0-9101-e9df219e5498","locationId":"fc2fb744-4d34-4276-be33-56bbc6af266e","ownerId":"fc2fb744-4d34-4276-be33-56bbc6af266e","ownerType":"LOCATION","deviceId":"2409a73c-918a-4d1f-b4f5-c27468c71d70","componentId":"main","capability":"thermostatOperatingState","attribute":"thermostatOperatingState","value":"cooling","valueType":"string","stateChange":true,"data":{},"subscriptionName":"My Home Assistant sub","commandId":"","sensitive":false}}

This doesn't seem to indicate anything wrong....and looks exactly like my other code.

#

For this I simply set it from 72 to 71 (second line)

naive crescent
#

Like, do you see if the commands we send are correct?

#

And are the responses what you'd expect?

hollow dove
#

The command sent was correct. I see it in the UI. Then a few seconds later, per the logs, it receives an update event. But that was not the command I sent.

2025-06-09 10:23:53.636 DEBUG (MainThread) [pysmartthings] Executing command for device 2409a73c-918a-4d1f-b4f5-c27468c71d70: {'component': 'main', 'capability': <Capability.THERMOSTAT_HEATING_SETPOINT: 'thermostatHeatingSetpoint'>, 'command': <Command.SET_HEATING_SETPOINT: 'setHeatingSetpoint'>, 'arguments': [68.0]}
2025-06-09 10:23:53.637 DEBUG (MainThread) [pysmartthings] Executing command for device 2409a73c-918a-4d1f-b4f5-c27468c71d70: {'component': 'main', 'capability': <Capability.THERMOSTAT_COOLING_SETPOINT: 'thermostatCoolingSetpoint'>, 'command': <Command.SET_COOLING_SETPOINT: 'setCoolingSetpoint'>, 'arguments': [71.0]}

These are what I did. Well, I didn't change the heat but I assume since its heat/cool, it just sends both.

I'm assuming this is the correct response:

2025-06-09 10:23:54.832 DEBUG (MainThread) [pysmartthings] Command response: {"results":[{"id":"6af9cc6c-aa1b-4ac8-8eb6-f3d7adc8f2ff","status":"ACCEPTED"}]}
2025-06-09 10:23:54.843 DEBUG (MainThread) [pysmartthings] Command response: {"results":[{"id":"8a08b264-6bd1-47c5-8a2d-fefb9069cc22","status":"ACCEPTED"}]}

However, all the stuff after it is NOT correct. It receives a cooling set point but I didn't set it anywhere.

2025-06-09 10:24:02.621 DEBUG (MainThread) [pysmartthings] Received event: {"eventTime":1749486242538,"eventType":"DEVICE_EVENT","deviceEvent":{"eventId":"27c394c8-454e-11f0-b325-5d5564bf1803","locationId":"fc2fb744-4d34-4276-be33-56bbc6af266e","ownerId":"fc2fb744-4d34-4276-be33-56bbc6af266e","ownerType":"LOCATION","deviceId":"2409a73c-918a-4d1f-b4f5-c27468c71d70","componentId":"main","capability":"thermostatCoolingSetpoint","attribute":"coolingSetpoint","value":68,"valueType":"number","unit":"F","stateChange":true,"data":{},"subscriptionName":"My Home Assistant sub","commandId":"","sensitive":false}}
naive crescent
#

If that is the case, then this is at smartthings or the integrators side

#

as in, we send the right command, but then ST or the thermostat decides to do this in stead

hollow dove
#

Yeah I can't seem to reproduce this in any other way so I'm not sure what's going on there. Its only doing it in HA. I dont' have any other Tokens out. I literally copied what the HA integration was doing in the above script to test. Is there any way I could do direct commands inside HA t o test? This makes zero sense based on those logs.

#

I've hard-restarted, rolled back, etc. Always the same

#

Even directly going into the integration its doing it (so not in a lovelace dashboard - was curious if maybe its the thermostat component)

#

Hold up

#

I just reproduced OUTSIDE of HA

#

using pysmartthings

#

Think its a multithread thing

#
pipenv run python -c "
import asyncio
import aiohttp
import pysmartthings
import os
from dotenv import load_dotenv

load_dotenv()

async def set_temps():
    token = os.getenv('SMARTTHINGS_TOKEN')
    
    async with aiohttp.ClientSession() as session:
        api = pysmartthings.SmartThings(_token=token, session=session)
        
        try:
            devices = await api.get_devices()
            thermostat = devices[0]
            
            print(f'Found thermostat: {thermostat.label}')

            print('Setting heating setpoint to 70°F and cooling setpoint to 74°F...')
            
            # Create both tasks without awaiting
            heating_task = api.execute_device_command(
                thermostat.device_id,
                pysmartthings.Capability.THERMOSTAT_HEATING_SETPOINT,
                pysmartthings.Command.SET_HEATING_SETPOINT,
                'main',
                argument=round(70, 3)
            )
            
            cooling_task = api.execute_device_command(
                thermostat.device_id,
                pysmartthings.Capability.THERMOSTAT_COOLING_SETPOINT,
                pysmartthings.Command.SET_COOLING_SETPOINT,
                'main',
                argument=round(74, 3)
            )
            
            # Await both tasks concurrently
            heating_result, cooling_result = await asyncio.gather(heating_task, cooling_task)
            
            print(f'Heating result: {heating_result}')
            print(f'Cooling result: {cooling_result}')
            print('Done!')
            
        except Exception as e:
            print(f'Error: {e}')

asyncio.run(set_temps())
"
#

This caused it to happen

#

So...not the integration!

#

In any case - you're right, its definitely not the integration per-se

naive crescent
#

Yes, the logs are quite straightforward when logging what we're sending down the line

hollow dove
#

Thanks for humoring me - I'll open an issue on the pysmarthings page.

naive crescent
#

Hold up

#

Then it's still my problem

hollow dove
#

I think you're right that its smart things though

#

This is a new issue

naive crescent
#

I don't see where this is my problem yet

#

Pysmartthings isn't their lib

hollow dove
#

Right but the psysmarthings code just sends POST commands right?

naive crescent
#

Yes

hollow dove
#

I think you're right that there's something on their side that if it detects some weird state, maybe some check or something, it does this override and makes a subsequent update. The fact that the above code that calls them without awaiting caused it shows its definitely not anything you/we are oding

#

And this definitely didn't exist as of last week or so

#

All roads point to an API change on their side internally

naive crescent
#

Like, you can Tinker with all the commands you want

hollow dove
#

I almso want to just try recreating with raw API reqeust s outside of a library

naive crescent
#

If we need to call something differently, then we should maybe look into that

#

But at this moment I don't think this is an issue on our side

hollow dove
#

I don't either

#

This could alos be my thermostat dying 🤷

#

Not your problem.

naive crescent
#

For a test you can try booting an older version that you know worked before I fucked up the heat cool

#

Lmao

hollow dove
#

I tried 2025.5.1...same issue

#

I just switched my thermostat to cool mode...now smart things is showing it as offline

#

So again, not your problem

#

Well anyway this has been the highlight of my day and a good distraction from work! Will report back just as a future potential troubleshooting issue. But as of now my thermostat is still not working so...this is definitely not your issue on either side

naive crescent
#

Great to hear

#

But good luck

#

You can always use the contact us button in the app to contact them and they can tell you something probably

#

Or just build your own native integration for your thermostat

hollow dove
#

Yeah this is a weird state of this dumb sensei thermostat that is then connected to SmartThings. My preference would be to not use this dumb thermostat.

naive crescent
#

Don't use it then

hollow dove
#

Came with the apartment - although updating it isn't that big of a deal it just rqeuires effort. Used to have Ecobee but I know they recently dropped the native HA support and went HomeKit, which is fine but bleh. I'm lazy and put things off (see...me doing all of this instead of any real work)