I copied a service_template from my working template fan and am trying to use it to control my heat pump. We only use four modes; off, dry, heat (23) and cool (18) so I’ve set this up an an input_select just like the template fan. However, when I select an option, nothing happens. The four scripts all work when fired on their own. Anyone see what I’ve done wrong?
Sorry to bug you again. Any idea on how I could build this out further to create my own heat_cool template switch based on the zone temperature?
I’ve built this on your advice above but I’m essentially wanting to add to it to check if the temperature is below 23 degrees, choose input_select ‘Heat 23’ and if it’s above, use ‘Cool 18’. Is that possible?
My hope is just to have the one template switch for the heat pump (that I can pass to Google and Alexa) and it sets the correct input_select option based on whether the temp is above or below 23 degrees and the sensor.hvac_office_power confirms whether the device is on or off.
That means there’s a problem with the value_template. The Template Switch uses that to determine its state (i.e. whether it considers itself to be on or off). You turn the switch on and then it evaluates value_template to set its state. If its state immediately returns back to off that means the value_template isn’t providing the correct state.
The simplest way to handle this is to use an input_boolean. The value_template simply reports the input_boolean’s state. The scripts you use must set the input_boolean’s state.
Note
I provided an example for a Template Fan in the following post. It uses an input_boolean to indicate the fan’s state. The input_boolean is set by the Template Fan’s turn_on and turn_off. I realize it’s not a Template Switch but the principle is the same.
Thank you, but that doesn’t explain why the one above it works (when manual setting options) What's wrong with my service template?. I think there is something wrong with the data_template and the input_select is not being called so the heat_pump doesn’t come on therefore no power is consumed and the switch turns off.
Let’s say the input_select’s state is currently ‘Heat 23’.
The office temperature is <= 23.
You turn on the Template Switch.
That will cause it to set the input_select to ‘Heat 23’.
HOWEVER, the input_select is already at ‘Heat 23’ so there’s no state-change.
Without a state-change, the automation is not triggered and script.office_aircon_heat_23 is not executed.
To prove the theory, review the log. It reports when automations are executed. If automation.office_aircon_control isn’t executed then we know the theory is correct.
Thanks, good advice. I’m not getting to that step though. I would have thought that if the input_select was on ‘Off’ and I turn on the template switch, the input_select should change based on the temperature but that is not happening.
Cracked it! Don’t ask me why but the options in the data_template do not work with quotes. Removed those and it is working as intended now. Thank you so much for your help.