Using a Helper to set Thermostat Setpoint?

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

Trace:

Executed: September 23, 2023 at 3:15:51 PM
Result:
params:
  domain: climate
  service: set_temperature
  service_data:
    hvac_mode: cool
    temperature: 64
    entity_id:
      - climate.bedroom
  target:
    entity_id:
      - climate.bedroom
running_script: false
limit: 10

I have tried to run the automation several times and get no change in the setpoint to 64.

Is it possible to do this?

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.

Describe your testing method.

Thanks for your comments. I have made the simplest form of a script to just set the temperature (the Thermostat is already set to Cool:

alias: Script Setpoint
sequence:
  - service: climate.set_temperature
    data:
      temperature: "{{ states('input_number.mbr_setpoint') }}"
    target:
      entity_id:
        - climate.bedroom
mode: single
icon: mdi:thermometer

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:

action:
  - service: climate.set_temperature
    data:
      temperature: "{{ state_attr('climate.living_room','temperature')  | float + 3.0 }}"
      hvac_mode: cool
    target:
      entity_id: climate.living_room

Which works fine. So at a loss on using a Helper to set Temperature. Some format issue?

I’m pretty much out of ideas… The only reasons I can think that this isn’t work are as follows:

  1. Incorrect entity ID’s.
  2. The state value of your helper is unknown, unavailable, or outside the climate entity’s allowed range.

But neither of those really makes sense with the traces/tests you’ve described.

You may just need to delete the helper and script/automation, restart HA, and start over.

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.

Try casting the template to and int

'{{ states("sensor.bedroom_target_temperature")|int }}'
temperature: "{{ states('input_number.mbr_setpoint')|int }}"

Sadly no difference. I had tried float before as well but no difference. No effect on thermostat. But thanks!

  1. Which integration is used to create climate.living_room?
  2. Are you able to set the temperature of climate.living_room via the Thermostat Card?

I am using the Honeywell Total Connect Comfort (US) Integration.

Yes I can set it with the Thermostat Card.

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?

Correct.

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):

state: "{{ state_attr('climate.bedroom','temperature')|int == 85 }}"

Seems to be an issue in setting a state with a template?

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?

Helper = 87 does not change thermostat…but thanks.

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:

service: climate.set_temperature
data:
  temperature: "{{ states('sensor.mbr_setpoint_set') }}"
target:
  entity_id: climate.bedroom

Note: works for Sensor and Helper entity in the template.

So what does that tell us about how to run this outside of DT? Not real expert on this stuff as you can tell.

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.

I’d also check the home assistant log for errors or warnings.

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.

Well the following tells us climate.bedroom has communication problems with the physical thermostat.

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:

Honeywell Total Connect Comfort (US) devices periodically go unavailable

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.