Rulemachine: two motion sensors but only one action

Hello,

I have a rule that I dont know how to write....

I have two motion sensors that trigger the same action. Sometimes it can happen that both motion sensors go active (depending on where a person moves), however I only want the action to trigger once and not twice if that is the case.

Is that possible?

Best regards

Yup. The trick is to specify both motion sensors in the trigger. Doing that will cause an "any" condition. You can throw a private boolean in there to make the rule fire only once, but I haven't had the need to do that on the rule below.

Probably, but if you have a description of what you actually want to do a or a screenshot of your existing rule, it would be much easier to help. It sounds like you could use the rule's Private Boolean (or any local--or I guess global--variable ... or any other method) to keep track of this and "reset" it when you're done. Something like this example from the Rule 4.0 documentation might be an example of what you're looking for:

image

I'm not sure how the rule in the previous post would help: the actions would still run (provided any conditions contained therein are met, as they likely would be above) any time either sensor changes to active or inactive, regardless of both sensors' previous states. You need something in the actions to say "hey, I've already run once" and a way to test for that and reset it when you're done (a purpose Private Boolean serves in this example). I may be missing or misunderstanding something, though.

1 Like

Yeah, the rules do run, but for lights and switches with boolean operations (on/off, set level, etc), I don't care honestly as I remember either Mike or Bruce (I think it was one of them?) saying that HE handles requests to turn on and off lights that are already on or off and set to the same level internally by not sending the message again. So, even if the rule runs, it's not supposed to cause resource issues or excessive messages to the devices in question.

The other interesting thing about not using PBs in my rules is that when motion is triggered and the mode changes, the lights change automatically and provide a cool changing effect. :wink:

You could use the built in app Zone Motion Controller.
Put in your 2 motion Sensors and it will create 1 virtual motion sensor that you put in your rule.

Thanks a lot guys! Zone motion controller works fine. Am I correct to use the "motion aggregation" mode for my purpose?

Yes, motion aggregation. Working very well for me. :slight_smile:

1 Like

That is what I use in my garage/workshop automation. I got tired of the lights turning off on me, especially if I was building something.

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