RM4 Help: multiple devices - independently

Hello, I am looking for help please. Here is the set up. I do not use a lot of motion sensors today, as such I have timers on lots of lighting devices to turn them off after a period of time.

In RM.25 I needed a rule for each device. I am happen to be at a place where I have had to move everything from that hub and toss it in the bin and I am therefore re-writing every rule under a new device. So I am looking to see if I can optimize the rules. Does anybody know if I can write 1 rule that independently tracks each light to see if it has been on for 30 minutes and then turns it off?

Trigger: For each light, turns on
Action wait 30 minutes (whatever) and turns that light off - but not all the others - hence independently.

Anybody know how to do that today in RM4?


So basically:

Trigger: Any light you define
Action: set timer on only the light that was the trigger?

So the hope is there is some sort of option in an Action to say "the device that triggered this"? I don't think that exists :frowning:

Yes, your interpretation of my poor notes is correct. I know WebCore could do this easy. It was called "For Each..."

Was hoping RM.4 might have some way...but maybe still not.

As a developer myself I've asked myself more than a few times since i've been into Hubitat "why isn't there a 'this' reference inside the rule machine?"

As you noted in your first post, not having that reference sure adds a lot of unnecessary time/setup

Did you try the %device% variable? Is that not capturing the device that triggered the event for you?

1 Like

Care to show that in a screen shot? I am not sure how to use the variable in the trigger

You don't use it in the trigger, you use it as a condition.

1 Like

Create a local variable and assign %device% to it. You can also use %value% and a few others.

This should help


Sweet, I'll play with this tonight (hopefully)


I use that extensively. It isn't as good as a real "this." As it still requires more work in the condition, but I can usually get to the same end result - which is the main thing.

1 Like

would this work to control differnt switchs indpendently, ie use the same rule for diffent switchs by adding them as a trigger? the format isnt right, but the concept?

triger events
light 1 change, light 2 change

if %device% on then
%device% off delayed 0:20:100 (cancelble)
%device% cancil deley
end if

I too would love to see what the rule for this actually looks like

The example in a few posts above doesn’t make much sense since I can’t see the whole thing and am not understanding what it actually does or how multiple devices are involved as trigger. At least it made me think “at least it’s possible” though!

Download the Hubitat app