Identify triggering device for a rule

I have a growing collection of dimmer switches in my home. A few of them I've got special functionality associated with the double-tap action, however most of them are setup for a "default" of double-tap "up" = 100% brightness and double-tap "down" = 10% brightness. This has resulted in a growing list of identical rules that only differ by the trigger device. Is there a way to combine these into a single rule, i.e. it is triggered by any of the dimmers, and then somehow in the actions of the rule determine which device triggered the rule and then only change the brightness of that dimmer?

Hi, I'm not a RM expert but .....

First you lost me with the double-tap description, then you shifted to determining which dimmer initiated a rule. I'm not sure if you have implemented the double-tap for scene control or is it still = 100% brightness?

Apart from the above question, if you have a bunch of rules with switch triggers. Combining those would be more complex that separate rules.
For instance it might be like.

Trigger:
Lamp1 changed
OR
Lamp2 changed
Or
LampN changed

Actions
IF Lamp1 action 111111
else IF Lamp2 action 22222

etc

Or you could use a switch structure:

switch
Switch is only available in groovy not RM .

Thanks for the reply, and apologies for the lack of clarity. I do have some dimmers where I'm using double-tap for scene control, but those are irrelevant to my question and I shouldn't have mentioned them. I concur that a if/then/else or switch would be messier than individual rules. What I was hoping for was something like:

Trigger:
double-tap switch1
OR double-tap switch2
OR double-tap switch3
Action: set level ${triggering-switch} 100%

where ${trigging-switch} is a variable or expression or similar construct that referenced the source of the trigger event.

Basically is should be the same as your current individuals with:

  1. all triggers OR's

  2. all actions with:

If switch2 = 4 type action here,
else if switch 3 = 4 action
else if switch N = N action
END-IF

There isn't an easy way to do this at the moment. Rule Machine does have a device (or %device% as you'd normally write it) variable that refers to the name of the triggering device, but Rule Machine doesn't actually have a variable that can be a device, so again, this is just the display name (device label if set, otherwise device name). If you really want to put them all in one rule, you could trigger based on whatever you want, then use IF THENs to check the device name. I demonstrated this approach (not sure if that's what is being suggested above?) in another thread:

However, that is more just proof that it's possible. I wouldn't actually recommend this. It's a bit messy, plus prone to typos and requires maintenance any time a device name changes. I think you'd be better off just using separate rules, one for each device--then you don't have to worry about this since you know the triggering device is also the one you need to change. Each rule will also be very simple to write: one trigger and one action. You could even use Button Controller instead of Rule Machine for this if you wanted.

If you're into Groovy, you could also write a custom app. I'm not aware of any existing community apps that can do this, at least not more easily than you could with a rule (needing to specify the device in both places).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.