If you have a wait for events and I am waiting for one of two buttons to be pushed, after the rule resumes, is there a way to distinguish which button caused the event?
I tried %device% and it just returns the device that originally triggered the rule.
I can change to using virtual switches so the state is retained after the rule resumes, but I would prefer to use buttons.
I can't think of any simple way off the top of my head, but it would be pretty easy with a virtual switch, as you say. If you aren't aware, virtual switches have a built-in capability to automatically turn themselves off after a specified timeframe (I'd pick one of the options that are just a few seconds long), so they can effectively act as a button. If you're using it for something (Dashboard is the only thing I can think of) where you prefer it to look like a button, I'd be surprised if someone hasn't written a driver that combines a virtual switch (with auto-off) and button. I couldn't find one with a quick search (someone correct me if I'm wrong), but it would be simple to do if not. You could also create a separate virtual button and have an automation that turns on the switch, but that seems like extra devices for no reason to me.
As you're probably aware, you could then use a conditional after the wait to see which switch is on (as long as it's within the few seconds afterwards) to determine which "button" was pressed. You can't do that with a button since the only conditions you can check there are the last button numbers for each event (pushed, held, etc.), and the
%device% variable always refers to the triggering device of the rule.
Thanks for the confirmation.
Yes I have used the auto-off feature before with VS and I have used it before but lately I have typically had the responding RM turn it off when it reacts to the switch - just being over cautious in case there was a delay.
Just playing with buttons for the first time to handshake RMs and I couldn’t easily find my own answer by searching.