Are two rules needed to turn a light on and off?

Just started messing around with RM a bit.

Are two rules really needed to turn a light on and off?
One for the "on" trigger, and one for the "off" trigger?
It seems that way, but I could be missing something.
I'm used to SA, and this would be one rule.

Thanks.

Nope, it can usually all be done in one rule. What are your requirements?

Starting off slow, I just wanted to try turning a light on and off by turning a switch on and off. It seems like the only way to do this is to have a RM rule to turn used the switched on as a trigger to turn it on, and another rule to use switched off as a trigger to turn it off.

I tried several things, and this was the only way I could do I it.

I figure there's gotta be a better way, but it's early.

If you set your trigger condition to "changed" your action can then be an if statement. So if ON do X else if off do Y.

1 Like

Another way to do it that is more efficient for HE is the use of wait events/conditions (events are preferred I think?):

Here is an example of the 'traditional' way of doing it with RM... (as mentioned by @jasazick)

As @cjkeenan mentioned, you can also streamline this using the 'new' technique.

It is good to have options!

2 Likes

I've got a ways to go, but here's my first effort.
I have to brush up on my Else, ElseIf, End, etc, etc, etc. Plus that other method. Plus everything else. But hey, it works.

1 Like

It'd be a good practice to end each IF block with an END-IF. Doesn't matter so much in this case, but this is much more important as you start creating rules with nested IF blocks.

2 Likes

if you're trying to do something as basic as that, i would recommend simple automations. it offers less overhead than rule machine and can achieve what you want within a single simple automation

1 Like

I kind of figured that, but I'm just starting out with RM.

This all started when I tried to figure out a way to send multiple commands with one trigger. I'm not using it yet, but the logs shows it works.

image

You did say RM, so this isn't really answering our question, but you can also use the built-in "Mirror" app if you're just trying to control a second switch when a first switch is changed.

Or if the switch has Central Scene capability, use the "Select Button Device" option and then set different actions for Button 1 and Button 2.

2 Likes

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