Rule Help - Persistent light state option with motion controller

A question about how to build lighting rules in Hubitat for a specific scenario.

Basically, I have a light bulb and motion sensor in the hallway. It works just fine but I want when I turn the light on manually (non-motion), it stays on and doesn't turn off when it detects motion events. Sometimes I just want the light on all the time (have a party or something) and whenever someone walks into the hallway, the light keeps turning on and off because it senses motion.

Something like:

If the light is on, do not process motion events.

Should I use "Motion Lighting Apps", "Rule Machine"? Do I do this as a restriction? Suggestions appreciated

Thanks

I have a virtual switch called party mode, itā€™s added as a restriction to any rules that I want to disable.

Thanks, ya I was thinking about that too but would prefer the condition to be related the the light status, IE: If itā€™s on, donā€™t do it. Iā€™m playing around with Rule Machine and seeing what I can come up with. I was hoping this would be fully automated. Without an App, logging onto the Hubitat website to press the Virtual Button is a bit cumbersome. Hoping for the mobile app soon so I can use restricted buttons for other actions/ideas. Thanks

@bravenel

How do I do this in Rule Machine?

1st Rule -> If light #1 is off and motion detected, turn on light #1. Chain this to 2nd rule
2nd Rule -> (Dormant, only invoked from 1st Rule). Loop this rule to evaluate motion every minute and turn off light #1 if no motion detected.

I tried playing around with Private Boolean, Evaluate Rules, etc but just canā€™t figure this out in RM. There is no way to change the order of Rule actions and just feel like I am stuck in a box. I am sure there is a way but really struggling to get Rule Machine to do such a simple task.

Iā€™m confused as to why you want to chain them. This is a simple one shot rule, detect motion, turn light on for the true condition, for false, turn off the light with a delay, in the delay section select cancel on truth change, this will keep the light on while there is still motion happening.

2 Likes

I tried to keep my explanation simple as to why, but Iā€™ll elaborate.

I donā€™t want motion events to take place on Light #1 if the light is already on. If I manually turn on the light, I donā€™t want the motion sensor to take over and turn it off when it stops sensing movement. Because of this, your suggestion wonā€™t work. I also donā€™t want to do a ā€œparty modeā€ switch, just a simple, ā€œIf the light is on, donā€™t do anythingā€

Secondarily, I need to isolate your suggestion (which is what I really want in the end) to a compartmentalised rule so that the evaluation of Rule #1 is the only invocation of these actions. If I donā€™t do this, again this rule would take over the bulb and turn it off once movement stops.

To keep things simple and remove the ā€œwhyā€ out of the equation, can someone please help explain:

  • How can I create a ā€œruleā€ that is only invoked from another rule (not a trigger/state change) and loop it?

Once I figure that out, I can take it from here. After using C0re/Webcore for so many years, I am finding it very difficult to figure out how to do this in Rule Machine.

Maybe you need to create a virtual switch thatā€™s tied to the real switch. If virtual switch is on (by manual switching on the lights) then use that virtual switch as a restriction for the motion sensing logic. When you manually switch off the lights again, the virtual switch turns off, thus allowing the automation to resume.

Was wonder what you ended up with? I am looking at really tuning my motion lighting more and I find the same problem. If the dimmer is switched into the "on" position manually I want this to suspend the motion lighting until the switch is then turned off again manually.

Also is there a way to do this with brightness? For example I have different brightness levels for certain rooms that when motion is detected and the mode is set to let's say "night" then turn lights on at this level. The problem is lets say I go into that room at night and the level is lower but I tell Alexa to raise the brightness to 100%, I want it to stay that way until the motion stops and the light is turned off or if I manually turn off the light.

Also would this be possible without using virtual switches using just RM, ML or SL.

You can do all of this with Motion Lighting.

So if I use the option "Switch to disable turning on" would this work? Meaning once the switch is pressed then motion lighting is disabled until this switch is off?

What about when I issue a command to set the dim level? Do I use the "Override for level only?" option?

Override works one of two ways, but always when you change a dimmer level:

The first way stops motion-inactive from turning the lights off, and stops additional motion-active events from changing the level back.

The second way (level-only) just stops the motion-active events from changing the level back, but motion-inactive will still turn them off.

Okay this makes sense, so if the lights were turned on by motion and I manually adjust the level with the override option enable, then this should prevent the next motion event from changing that level or turning the light off.

Yes, but don't select "Override for level only?" if you want them to stay on.

Thanks, this helped a lot.

@bravenet I wasnā€™t able to get this to work. Iā€™m using Lutron switches and dimmers and setting the option for ā€œswitch to disable turning offā€ caused my lights to turn on by motion and then would never shut off. I contacted support about it and Bobby told me this is intended behavior and the way to do it would be to create a virtual switch and have it poll for manual button press to disable the motion. I havenā€™t yet set this up as Iā€™m awaiting his response I just replied tonight.

Could you describe what you want to happen? In detail...

All my switches and dimmers are Lutron Caseta.

I would like the lights to work on motion sensor 30 minutes before sunset through until 30 minutes after sunrise, also be able to disable motion detection by pressing the light on at the switch or dimmer until it's turned off at the switch. When itā€™s turned on I would prefer it turn on at the dimming level set by the mode and resume in the proper mode based on time of day for dimming level. I would like all lights in the house to be turned off when mode away is activated except my sons room (I currently control this with a simple lighting rule that is working fine). They should however continue to function on motion detection while in away mode as my son is home at times when I am not and he does not want to be hooked up to any presence detection.

If mode is day and manual turn on then set brightness to 100%.

OK, let's take it a step at a time, starting with the very last step: For Day mode manual turn on to 100% use Mode Lighting, and only specify Day mode. In Option for On select those switches that you want to activate the lights on with (could be all of them), and likewise in Options for off select those switches that should turn all of the lights off.

For the motion part, you can put the time restriction in Motion Lighting for 30 before sunset to 30 after sunrise. The disable part is a bit tricky the way you've described it working, so I will address that last.

For turning all of the lights off (except son's room) when Away, a Simple Lighting rule will do that. For the motion lighting to continue to work while Away, just include that mode in the Motion Lighting app you setup.

That leaves the disable part: I think the idea of using a virtual switch is a good one. You'd use that virtual switch to disable either on or off or both (as desired) in Motion Lighting. To set the virtual switch use Rule Machine rule with "Physical Switch" as the condition. Use the true part to turn on the virtual switch, and the false part to turn it off. I couldn't tell from your description whether you wanted on or off or either to cause this. But you can write the rule to accommodate that choice. For the lights coming back on to the right level, I'd again use Mode Lighting (as above for Day mode), adding the other modes. Mode Lighting will catch the turning on with the switch, while Motion Lighting will handle the motion activation part.

Edited: You could also do the lights coming back on from manual on by selecting the switches in Motion Lighting under Options for On, Activate with these switches.

Iā€™ll look at this tomorrow. Thank you for the reply. Itā€™s sleey time for me currently.