Hello! I’m trying to set automation to get parameter from MQTT broker and set the input boolean state. Here is my code:
- alias: Test
initial_state: true
trigger:
platform: mqtt
topic: matrix/WiFiPanel-0/dta
action:
- service_template: >
{% if {{trigger.payload.split(" ")[1].split(";")[0].split("|")[0].split(":")[1]}} == 0 %}
input_boolean.turn_off
{% else %}
input_boolean.turn_on
{% endif %}
data:
entity_id: input_boolean.switch_state
But it doesn’t work. I tried to modify it in different ways, but no luck. I’m getting this error in log:
Invalid config for [automation]: Service input_boolean.turn_"{{ 'off' if {% if {{trigger.payload.split(" ")[1].split(";")[0].split("|")[0].split(":")[1]}} == 0 else 'on' }}" does not match format <domain>.<name> for dictionary value @ data['action'][2]['service_template']. Got None. (See /config/configuration.yaml, line 56).
What I’m doing wrong?