I have tried to use a Helper to set the Thermostat Setpoint to its value rather than entering a number. I have verified that the Helper Entity name is correct and contains the proper value (64). I can set the thermostat OK with a regular number like 75. However when I test the template in DT it shows the correct number from the Helper and if I trace the automation it shows no errors and the correct “temperature” (64).
Automation:
alias: Therm set Evening Temps - Test
description: Tests ability to set MBR temp to value of helper
trigger: []
condition: []
action:
- service: climate.set_temperature
data:
hvac_mode: cool
temperature: "{{ states('input_number.mbr_setpoint') }}"
target:
entity_id: climate.bedroom
enabled: true
mode: single
Yes, though you may find it to work more reliably if you split the mode setting into it’s own service call.
alias: Therm set Evening Temps - Test
description: Tests ability to set MBR temp to value of helper
trigger: []
condition: []
action:
- service: climate.set_temperature
data:
temperature: "{{ states('input_number.mbr_setpoint') }}"
target:
entity_id: climate.bedroom
- service: climate.set_hvac_mode
data:
hvac_mode: cool
target:
entity_id: climate.bedroom
mode: single
Also, if you do not plan on defining a trigger, you should not set this up as an automation. Instead, it should be a script.
When I run it Nothing happens to the Thermostat. I get no errors on Trace and the Step Details shows the temperature at 64 (which is what I have the Helper set to). If I replace the template with a straight number like 87 and run the Script, it sets the thermostat to 87.
I have used templates with Setpoints in the past. One was to add 3 degrees to the current setpoint:
I did check the ID of the Helper and it shows up on an Entities card with a slider. I also have restarted HA to no avail. A real head scratcher. But thanks for you insights.
The script’s trace reports it set the climate entity’s temperature to the Input Number’s value (64) but you’re saying the climate entity’s temperature failed to actually change?
I also just tried creating a sensor that loads the helper and gave that to the Thermostat. Trace shows 64 as usual, but no change in thermostat.
One other data point is that I can retrieve attribute values from thermostat with templates and it works (this checks if setpoint was set to expected value true/false):
Maybe a silly thing, but could it be a problem with the value itself, not with the way you specify it? You tested with a manual value 87 and that works, but the input number with 64 does not. Have you tried setting the input helper to 87?
You sometimes refer to the code as an automation, and in other places also as a script. As an automation it will not do anything by itself, because you did not specify a trigger. Is it a script or an automation, and how do you make sure it is executed? Have you tried calling the service from the developer page instead of trough the automation/script?
It’s not normally a problem; it’s limited to your particular situation.
The fact that the script trace indicates it the template rendered a value of 64 confirms the template is fine. What happens after that appears to be anomalous.
I have done both, as an automation to start and also as a script later on. The results are the same. I ran the automatons with the Run command in the Automation mode and the Scripts with the Run Script option. I changed to scripts when the issue was brought up and only referenced an automation recently to show I was able able to get an attribute value…bit of an aside but thought maybe the Integration simply doesn’t work with Templates. Sorry for any confusion.
I took your suggestion and ran the climate.set_temperature service in DT using the template…and it works!!! Thermostat changes to template value. Here it is:
Have you verified in developer tools / services that you can actually set the setpoint? There you won’t be setting it to your input number but rather a hard coded value. I’m starting the think the problem is not the automation but rather the integration or device.
See most recent reply to running from service in DT. It works with the template that uses the Sensor and Helper entities. Checked log for climate.bedroom and I see it became unavailable several times today…likely during the Script testing. But no errors at the time I ran from DT service.
I began seeing the Script working for a while then not (on both Run Script and DT Service). This was sometimes accompanied by Log Error Unavailable for a short time. I drilled down a bit and found that others are having this problem of thermostats becoming unavailable frequently. See the following:
Possible issue is that some of the TCC website may be slowing down at times causing errors in response.
This makes reliable control of the Thermostats difficult at best.
Seems to be telling me that the problem is not with my Scripts, but the connection to TCC as @123 Taras commented. May have to set up some sort of confirmation of proper setpoint change with retries. Interested in your comments.