Hello!
I’m trying to create myself a blueprint that will listen to a topic for button-presses on Tasmota Devices with detached buttons (SetOption73 ON).
According to HA Docs I should be able to use trigger.payload_json in trigger_variables:
Yet my atempt (in green) below fails to work. When using red lines my blueprint works, with green lines it does not. What am I missing here?
For copy paste purposes
trigger_variables:
_device: !input tasmota_device
_button: !input tasmota_button
#button: '{{ _button if _button is string else "Button1" }}'
button: >
{{
trigger.payload_json.Button1.Action if (_button|string == "Button1" and trigger.payload_json.Button1 is defined) else
trigger.payload_json.Button2.Action if (_button|string == "Button2" and trigger.payload_json.Button2 is defined) else
trigger.payload_json.Button3.Action if (_button|string == "Button3" and trigger.payload_json.Button3 is defined) else
trigger.payload_json.Button4.Action if (_button|string == "Button4" and trigger.payload_json.Button4 is defined)
}}
_topic: !input tasmota_topic
topic: '{{ _topic if _topic != "." else _device|replace("switch.", "")|replace("-","_") }}'
trigger:
- platform: mqtt
id: 'single'
topic: '{{ topic }}'
payload: 'SINGLE'
#value_template: '{{ value_json.Button1.Action if value_json.Button1 is defined}}'
value_template: '{{ button }}'