Hi all!
I have problem sending array of integers, when using templating.
Automation with json formatting works for sending array of integers. In my example for “payload”:
Service knx.send
{“address”: “5/2/2”, “payload”: [12,26]}
But when I use data_template I cannot get it to send array of integers.
- data_template:
address: 5/2/2
payload: ['{% if is_state("input_select.tvatt_maltemperatur", "18") %} [7,8] {% elif is_state("input_select.tvatt_maltemperatur", "19") %} [7,108] {% elif is_state("input_select.tvatt_maltemperatur", "20") %} [7,208] {% elif is_state("input_select.tvatt_maltemperatur", "21") %} [12,26] {% elif is_state("input_select.tvatt_maltemperatur", "22") %} [12,76] {% elif is_state("input_select.tvatt_maltemperatur", "23") %} [12,126] {% elif is_state("input_select.tvatt_maltemperatur", "24") %} [12,176] {% elif is_state("input_select.tvatt_maltemperatur", "25") %} [12,226] {% endif %}']
The log says error:
[homeassistant.core] Invalid service data for knx.send: expected int for dictionary value @ data[‘payload’]
I have tried different formats with ’ and ", but no success yet.
So it seems that template cannot send array of integers. This way I have to create a lot of automations insted of using one template. For me that results in 50+ automations instead of 7 automations…
Any ideas?
Best
/PH