cancel
Showing results for 
Search instead for 
Did you mean: 

Temperature Automation Script Doesn't Override Thermostat

JoelDKraft
Community Member

I have a pretty basic script to only allow my Nest thermostat to be set down to 72 degrees.

 

metadata:
name: Turn Down the AC
description: Enforce a Minimum AC Setting of 72F
automations:
starters:
- type: device.state.TemperatureSetting
device: Thermostat - Dining Room
state: thermostatTemperatureSetpoint
lessThan: 72F
condition:
type: device.state.TemperatureSetting
device: Thermostat - Dining Room
state: thermostatMode
is: cool
actions:
- type: device.command.ThermostatTemperatureSetpoint
devices: Thermostat - Dining Room
thermostatTemperatureSetpoint: 72F

The script seems correct to me, and when I set the temperature via the Nest app, everything works great. I set the temperature to 71, and within a second it changes back to 72. Perfect!

My problem is that it doesn't seem to do that when someone sets the physical thermostat.

It recognizes that the temperature has been changed to a trigger value:

8/13/24 8:41:19 PM [INFO] Action succeeded for: [Thermostat].
8/13/24 8:41:18 PM [INFO] Automation check: conditions met.
8/13/24 8:41:18 PM [INFO] Starter check: conditions met.
8/13/24 8:41:17 PM [INFO] Automation started by: [Thermostat] because [home.graph.traits.TemperatureSetting/thermostat_mode] [string_value: "cool"].
8/13/24 8:41:17 PM [INFO] Automation started by: [Thermostat] because [home.graph.traits.TemperatureSetting/thermostat_temperature_setpoint] [float_value: 20.967682].
8/13/24 8:41:17 PM [INFO] Automation started by: [Thermostat] because [home.graph.traits.TemperatureSetting/thermostat_temperature_ambient] [float_value: 24.149994].
8/13/24 8:41:17 PM [INFO] Automation started by: [Thermostat] because [home.graph.traits.TemperatureSetting/thermostat_humidity_ambient] [float_value: 58.399994].
8/13/24 8:41:17 PM [INFO] Automation started by: [Thermostat] because [home.graph.traits.TemperatureSetting/active_thermostat_mode] [string_value: "cool"].
8/13/24 8:41:17 PM [INFO] Automation started by: [Thermostat] because [home.graph.traits.TemperatureSetting/target_temp_reached_estimate_unix_timestamp_sec] [long_value: 1723606875].

But even though the log says that the action succeeded, the temperature is not changed back to 72. Am I missing something??

 

1 Recommended Answer

GBD
Bronze
Bronze

My only guess as to why your script isn't working as intended is that the thermostat is rejecting remote commands for a period of time after it's locally set. You could try adding a delay as your first action to see if that helps.

View Recommended Answer in original post

2 REPLIES 2

GBD
Bronze
Bronze

My only guess as to why your script isn't working as intended is that the thermostat is rejecting remote commands for a period of time after it's locally set. You could try adding a delay as your first action to see if that helps.

JoelDKraft
Community Member

Of course now that you say it, this seems obvious. It could be that it's not accepting commands, though I would hope it would give an error in that circumstance. It could also be some sort of race condition during the turning of the dial where the change actually gets overridden immediately without firing another event.

In any case, I did put in the delay, and it seems to be working so far!