Motion Lighting Configuration

Thanks - so, the only thing you previous message confused me on slightly was using the same virtual switch for both ‘disable-on’ and ‘disable-off’. If Motion lighting subscribes to the ‘on’ state for both of those conditions, I think what I’ve built will work fine.

Thanks.

Yes, you are right, that should work fine. I use that in one of my Motion Lighting rules. I probably misspoke before...

1 Like

There needs to be an app that can do this:

  1. Motion triggers light
  2. Secondary Switch can be turned on/off based on an extra condition after a specified amount of time. (Door closed after motion event)
  3. Motion off disabled if motion becomes active after door is closed
  4. Motion Off enabled after door is opened
  5. Switches can be turned off at different times after motion stops

This would be ideal for a Bathroom that has a light and a fan.

Switch 1
Switch 2
Motion
Contact

Why not just write a Bathroom App? I’ve seen you mention this use-case multiple times now. It seems to be a fairly specialized use case for a bathroom. You could write an App that handles this and then share it with the community.

This can be done with two rules in RM.

2 Likes

Actually, most of my rooms have this feature.

I don’t want the lights, tv, etc., to turn off if I am in the room.

The easiest thing was:
If motion changes to active and door is closed, then pause automation.

If door opens then resume automation.

1 Like

I am pretty techie and I just don’t see how in RM this can be done in just 2 rules.

Enlighten me please.



First rule is the motion rule. It's going to turn on the light whenever motion is detected (your #1 above), and then turn it off 2 minutes after motion stops (your #5 above). Notice that it can be disabled by its own Private Boolean

Complexity comes in the second triggered rule for the door. If the motion becomes active and the door is closed (your #3 above), then it turns on the fan and disables first rule. That means that even if motion stops, the light is going to stay on. Then when the door opens it starts a timer for when to turn off the fan (your #5 above), and re-enables motion turning off the light with its timer (your #4). For good measure, it runs the first rule to be sure that the light is going to turn off, even if motion had already stopped when the door is opened.

Notice that the triggered rule fires on either of two events: motion active or the door becoming open. If it fires from motion active but the door is open, then the rule part is false, the fan switch is scheduled to turn off (it is already off), the motion off is enabled (it is already enabled), and the rule is run (it already just ran). But, if it is triggered by the door opening, then it does those same actions as your use case calls for.

1 Like

@bravenel you’ve been doing this for too long :smile: . I could barely process what was being asked and you pulled it out in 10 minutes.

1 Like

I understand everything.

The “problem to solve” is the delayed On for the Fan…

Don’t want the Fan to come on if it’s just pee pee…

If boo boo, say for in there for at least 4 minutes, then turn on Fan…

That’s easy, just delay turning on the fan in the second rule. There is an action for Delayed Off that can be flipped to Delayed On.

Ok, I’m going to play around with this. I appreciate your help.

I REALLY want to be able to move over to HE…I am a Guru in the ST community and I know I have to rethink how RM works.

Being able to simplify as much as possible is my #1 goal.

Bahaha. So you say. :wink:

There's a certain type of logic that's used for home automation that is ... slightly tangental to traditional logic. You can learn it but it's not intuitive for many people.

As an example, "disable on" and "disable off" in home automation means disabled when on, enabled when off for the first, and the opposite for the latter... But traditional logic would assume that the first switch turns ON the disable, and the second switch turns OFF the disable.

1 Like

I actually like @ogiewon’s suggestion of writing an app to do this. It’s not a very difficult app.

When RM first came into existence, it was common for me to write little apps like this one all of the time for people in the community. But so many people kept clamoring for a “rules engine”. So, over a weekend Rule Machine was created. It grew rapidly once released, as people had more and more requests for little features here and there. It is by no means an ideal tool, but it is a very flexible and adaptable tool that can be made to do many tricks. Personally, I don’t use it for very many complex automations such as the one you are looking at.

Later, I found that a dedicated app such as Motion Lighting filled a real niche. To do the more complex Motion Lighting applications requires multiple rules. I dislike the clutter of multiple rules to handle a single automation, such as this one. My efforts recently have been to distill generalizations of things like motion activated lighting into a general purpose app, such as Motion Lighting. I have 30 instances of Motion Lighting in my system, and 56 rules. I used to have something like 120 rules.

In my system overall, I only use 7 apps. But 4 of those have about 100 child apps (Button Controllers, Lutron Integrations, Motion Lighting and Rule Machine). The 3 others are Amazon Echo App, Life360 Connector, and Mode Manager.

We will continue to add a few apps that are generalized and can help people easily set up their automations with efficiency. We are open to suggestions along these lines.

3 Likes

Thats precisely the difficulty I have when setting up my automations. I have to turn my thinking on its side to get through anything other than the simple setups.

I agree. These were always arbitrary choices that were made, and not all of them are consistent in the sense you mean. There is a presumption -- actually a not very good one -- that people will actually think through these things somewhat carefully. Simple is better, almost always. But, there are instances where automations are complex by nature. There is a balancing act when writing these apps between keeping things simple, and providing a covering set of capabilities.

I’m racking my brain to think of a simple way to describe the function in a more clear way without being too wordy. Not coming up with anything yet. :wink:

so i am struggling with the following:

I have a single virtual switch “motion override”

in motion lighting i have set that up to be the switchonenabled and switchoffenabled

when that switch is turned on only switchonenabled is effected.

what i am attempting to accomplish:

person has entered room, tripped motion. lights on. perhaps through dimmer or alexa overridden dim level (perhaps not), now wants to leave the light setting at current. no turn off, no motion re-setting to the preprogrammed dim level by mode. That virtual switch might be changed by: physical switch, alexa, phone (someday), dashboard / tablet (someday) or a pico.

thoughts?

My suggestion: If you’re trying to do anything more complicated than “sense motion, turn on light. Motion stops, wait x minutes, turn off light” then you’re probably better off using Rule Engine. Yes, there are other options but that’s really the focus of the app.

Had some time to play with this.

Delayed On works but will work regardless if door is opened before the wait period. The fan will still come on.

Pending On works only if motions “Stays” active during the wait period. Seems like the timer resets every-time motion goes inactive and then back to active. The result is the fan does not come on as desired.

Unfortunately, I have no idea how to even begin writing an App but I am willing to try!

You did help me get the rules down to 4 now plus a Virtual Switch.

Motion Lighting doesn’t seem to play nice with my GE Switches…