I’ve been reviewing some flows I created to handle Hue dimmer switches.
I use the Events All node to capture what is happening (they do not set state).
My first iteration was:
This would then send a message for each action supported by the dimmer. After a few months I realised I should included zha_event as the Event type - this probably reduced the load on the system.
Today, I receive those events and pass them to a sub flow to handle the specific command sent. As I was adding some steps to inject other data I realise that I’m handing messages for several commands that I then throw away. For example pressing the Dim Up button, sends three messages with different commands - ‘step’, ‘up_press’ and ‘up_short_release’ - my logic only needs one of these.
I finally understood that I could enhance the event data field with the command I wanted to capture too:
Match on the Hue Dimmer’s unique id:
{“device_ieee”:“00:17:88:01:0b:59:ef:1f”}
Match on the Hue Dimmer’s unique id and the command:
{“device_ieee”:“00:17:88:01:0b:59:ef:1f”,“command”:“step”}}
This is much cleaner - and when debugging several steps, reduces the number of messages.
Now I understand that I can filter only the commands I want to see I have something like this:
One filter with command = on, power_off and step respectively.
Is there a way to use wildcards in the Event data to simplify this to a single events all node?
This DID NOT WORK:
{
“device_ieee”: “00:17:88:01:0b:59:ef:1f”,
“command”: “{{on|off_press}}”
}