Hello!
I am currently trying to create a Blueprint for a Zigbee Xiaomi remote button, using ZHA events.
I managed to the the double, triple, quadruple and multiple button presses working, but the apparently most simple one, the “single” press, wasn’t working!
This is the important part of the Blueprint:
action:
- variables:
args_attr_id: '{{ trigger.event.data.args.attribute_id }}'
args_attr_name: '{{ trigger.event.data.args.attribute_name }}'
args_val: '{{ trigger.event.data.args.value }}'
- choose:
- conditions:
- '{{ args_attr_id == 0 }}'
- '{{ args_attr_name == ''on_off'' }}'
- '{{ args_attr_name == 0}}'
sequence: !input 'remote_button_short_press'
- conditions:
- '{{ args_attr_id == 32768 }}'
- '{{ args_attr_name == ''Unknown'' }}'
- '{{ args_val == 2 }}'
sequence: !input 'remote_button_double_press'
- conditions:
- '{{ args_attr_id == 32768 }}'
- '{{ args_attr_name == ''Unknown'' }}'
- '{{ args_val == 3 }}'
sequence: !input 'remote_button_triple_press'
- conditions:
- '{{ args_attr_id == 32768 }}'
- '{{ args_attr_name == ''Unknown'' }}'
- '{{ args_val == 4 }}'
sequence: !input 'remote_button_quadruple_press'
- conditions:
- '{{ args_attr_id == 5 }}'
- '{{ args_attr_name == ''model'' }}'
- '{{ args_val == ''lumi.sensor_switch.aq2'' }}'
sequence: !input 'remote_button_multiple_press'
Basically, all the conditions are working, except for the first one:
- conditions:
- '{{ args_attr_id == 0 }}'
- '{{ args_attr_name == ''on_off'' }}'
- '{{ args_attr_name == 0}}'
sequence: !input 'remote_button_short_press'
After some debugging, I found out that the variable args_attr_name is being parsed into a Bool variable (by logging it’s value, i get either Bool.true or Bool.false), and that is causing the conditions not to be met.
I have tried stuff like:
- '{{ args_attr_name == false}}'
- '{{ args_attr_name == "false"}}'
- '{{ args_attr_name == Bool.false}}'
But none of these work. Someone got a clue on how to compare bool variables?
Note: That variable being parsed into a boolean is weird behaviour, because there are other JSON fields that have the same value (0 as an example), and get parsed into integer fields, and are easily compared using the == operator!
Thanks in advance!