Newbie problem
How to use templates in the following situation. Have this UI-generated script:
‘’’
modbustx:
alias: modbustx
sequence:
- service: modbus.write_register
data:
address: 5
unit: 1
value: 200
hub: hub1
mode: queued
max: 10
‘’’
Wanted solution is to use a template something like
‘’’
modbustx:
description: “Send set point offset to temperature controller 1”
sequence:>
{% if (is_state(“input_boolean.ibstat1”, “on”) and is_state(“input_boolean.ibstat2”, “off”)) -%}- service: modbus.write_register
data_template:
address: 3
unit: 1
hub: hub1
value: “{{ input_number.inboost }}”
{%- endif %}
- service: modbus.write_register
{% if (is_state(“input_boolean.ibstat1”, “on”) and is_state(“input_boolean.ibstat2”, “on”)) -%}
modbus.write_register
{%- endif %}
{% if (is_state(“input_boolean.ibstat1”, “off”) and is_state(“input_boolean.ibstat2”, “on”)) -%}
modbus.write_register
{%- endif %}
{% if (is_state(“input_boolean.ibstat1”, “off”) and is_state(“input_boolean.ibstat2”, “off”)) -%}
modbus.write_register
{%- endif %}
‘’’
Doable ?
I can’t figure out the right syntax