RM Example: Using Private Boolean to disable Motion Off


What it does: The light in this room is controlled by both Motion and a Pico remote. Motion causes the light to be daytime bright, but not 100% and the Pico’s 5 buttons are programmed to set 5 different dim levels. Motion ends and the light turns off 7 minutes later, automatically. Pico buttons cause the off action to be delayed to one hour. There’s an interaction though: to press a pico button, motion is detected and thus the light will be shut off in 7 minutes. Private Boolean is used to halt the Motion Rule.

I use Advanced Button Controller (ABC) from stephack and because it can’t directly interact with Rules, a Virtual Switch is needed.

Use: When a person walks in the room motion is detected and turns the light on. It’s turned off again in 7 minutes. If the person is still in the room, hand waving will, of course, turn the light back on. An alternative is to press any of the top 4 buttons of a Pico to set a specific dim level and disable motion for an hour.

Step 1: Virtual Switch.
This switch indicates the use of the Pico and updates the state of the Private Boolean. There’s only three required fields (marked with *) to create a Virtual Switch. 1) Device Name; 2) Device Network ID and 3) device Type. The Name and the network ID can be anything you choose but the Device Network ID needs to be unique. Note that Wave uses the numbers between 1 and 253 and therefore it’s wise to not use any pure number as the virtual’s network ID. The Type is a drop down and if you press V on your keyboard, the list scrolls directly to the virtual drivers.

Select 5 seconds for Enable Auto Off to turn the Switch into a momentary button.

Step 2: Add the Virtual Switch to ABC.
The Pico buttons (via ABC) directly set the dim level, but I want to know that the Pico has been used to block the motion off action. If the Pico button assigned to “OFF” is pressed, the virtual switch is set off too.

Step 3: Rule 1. Turn the light off in an hour.
A very basic Rule. When the Virtual switch is on, disable Rule 2. When the Virtual Switch goes to off, wait 60 minutes and set the Virtual Switch to Off and enable Rule 2.

Step 4: Rule 2.
There’s nothing special about this simple motion lighting Rule, except that Private Boolean has been enabled, At the very bottom.. under Restrictions. The Boolean is always preset (initialized) to True. As a result, enabling Private Boolean does nothing on it’s own. Rule 1, in this case, does the work. When the Private Boolean for this Rule is True, the Rule works as defined, Motion occurs and the light is turned on, motion ends and as long as there are no further motion events, the light goes off after a 7 minute delay. If the Private Boolean is set to False however, the Rule is prevented from evaluating and it’s as if the Rule had been deleted.

Because I’m using a Virtual Switch, I could have used another method besides Private Boolean. I could have used “Switch to Disable Rule” and the affect would be identical, I believe. When I started planning this out, I thought I’d directly set/reset the Private Boolean from ABC. Of course ABC and Rule Machine are entirely different apps and don’t exchange data like Private Boolean.


Why don't you just set private boolean to false and run an action with a delay of 1 hour to turn it back true in button Controller. Seems a lot simpler to me and no virtual switches necessary.


Hi everyone

I have just posted a request for help regarding Private Booleans here

Can anyone here help to differentiate physical and programmatic switch activity at the rule level?