Does anybody know how to make a service_template that acts like:
service_template: if( 1 AND 2 ) switch, elif(2 AND 3) switch
Here’s some dummy code for further illustration:
automation:
- alias: 'Thermostat A/C state monitor'
....(lots of code)....
action:
service_template: >
{% if {{is_state("switch.ac_power", "off")}} AND {{is_state("input_boolean.thermostat_control", "on")}} AND {{is_state("input_select.thermostat_ai_mode", "Avg all rooms")}} AND {{ float(states.sensor.indoor_temp.state) >= ( float(states.input_slider.thermostat.state) + float(1.0) ) }}%} switch.turn_on
{% elif %} .....LOTS OF OTHER CONDTIONS.....
{% endif %}
entity_id: switch.ac_power
I’m no code ninja with Jinja2