Dear All,
sounds weird,(at least to me being in 2024), I cannot find a ‘test’ in an automation-trigger testing on multiple conditions / values.
Here my trigger:
*trigger:
- platform: mqtt
topic: tele/BigDoor/SENSOR
payload: “OFF”
value_template: “{{ value_json.Switch1 }}”
id: Door opened- platform: mqtt
topic: tele/BigDoor/SENSOR
payload: “OFF”
value_template: “{{ value_json.Switch2 }}”
id: Door closed- platform: mqtt
topic: tele/BigDoor/SENSOR
payload: “ON”
value_template: “{{ value_json.Switch3 }}”
id: Door interrupted- platform: mqtt
topic: tele/BigDoor/SENSOR
payload: “ON”
value_template: >
{{ iif(value_json.Switch1 == ‘ON’ AND value_json.Switch2 == ‘ON’, “ON”, “OFF”) }}
id: Was interrupted*
My TASMOTA sends e.g.:
07:12:10.503 MQT: tele/BigDoor/SENSOR = {“Time”:“2024-01-16T07:12:10”,“Switch1”:“ON”,“Switch2”:“ON”,“Switch3”:“OFF”}
The problem arises at the word ‘AND’ at the end of the last of my triggers.
I want to test on multiple switches.
I tested various expressions like ‘&’ and ‘&&’, checked the community and the Jinja-doc… but there is nothing, at least I did not find it.
I tried also to help myself by concat 2 values like value_json.Switch1.concat(value_json.Switch2) and testing for ‘ONON’ - horrible solution…yes. But no success, not even half way working.
Also this:
“Switch1”:“ON”,“Switch2”:“ON” with wildcards at the front and end … no not , no wildcards
Any help appreciated.
Regards Jörg