Stepping up light levels incrementally

Using basic rules I have a rule that when someone enters the bathroom between 5am and sunrise, the motion sensor turn the lights on at a low level and climb incrementally every 2 mins till it reaches 100%. It seems not to be working like it should. They do turn on but don't increment. (Note using Lutron Caseta switches). Any tips would be appreciated.

Is it possible that while the person is in there they keep reactivating the motion sensor and restarting another instance of the rule, which sets them to 5 every time? What is meant to happen when the person leaves the bathroom? You could test by disabling whatever rule turns the lights off after use, and see if then the lights gradually come up to 100 when there is no further motion

Light would manually go off. But looking at events it's not re-tripping the rule. I've set it off and just watched it without moving and it doesn't go past the first part of the rule...

Those may support a setLevel(level, rampTime). Ramp time I believe may be in seconds, so something like setLevel(100,480) might work better for you.

2 Likes

A Rule Machine rule might allow you to do this:

Note that turning it off will not stop the ramp up, it will turn back on and continue until it reaches its target. To avoid this, the following would be needed:

Finally, it will re-start with every motion event, so you might want to start the rule with an if condition that looks for the lights being off before running the first line (not the wait as it will have been cancelled by the rule re-triggering…).

1 Like

I will give that a whirl. Thank you muchly... Doing an RM rule was my next step. You guys kinda confirmed this for me...

1 Like

This is what I came up with. What do you think?

Looks good! The only thing is that I suspect that turning it off by the switch won’t work (I’ll be curious if you try it - I only tried it with the virtual switch).

I could add if button press = off exit rule?

Button presses are events, not conditions, and exiting a rule just stops running additional actions--it doesn't un-schedule any jobs, un-subscribe to anything that may have been created by waits, etc. I guess that's a long way of saying "no." :slight_smile: But what you can do is make a separate rule triggered by that button press than runs "Cancel Rule Timers" on this rule. That will target the scheduled jobs created by the "fade."

But another question about your rule: does your dimmer ever report level = 0? Most don't. A common mistake is to assume this means switch = off, but these attributes are tracked separately. It's likely you want to check the switch state instead, and likely fade up starting at level 1 or 5 or something small (0 is generally not valid, or a "Set Level" to 0 is normally equivalent to an "Off" command).

1 Like

They're lutron so they have level and status

I suspect that exiting the rule won’t help. As I understand it, the issue is that the device will continue to execute the commands as they are scheduled. The “Stop dimmer fade” command should work.

1 Like

Assuming you mean switch, as pictured, this is typical and usually works how I described above. (That being said, I don't have any Lutron dimmers, but it would be unusual.)

I think with the Lutron 0=off. As there is no off option in the fade condition for the dimmer only dimming level I picked 0. I confirmed the action by watching status when the dimmer level is set for 0 status sets to off, dimmer level 1 sets to on, so I assume that off=0 to the rule.

The Switch condition will work for a dimmer. :slight_smile:

Yeah, a setLevel(0) is normally synonymous with off() in most drivers. A different question is what level it reports afterwards; for all devices I've seen, that's the last known level (from when it was on). The switch attribute would be the one to watch instead.

I guess my thought process was setting it to pressing the physical dimmer switch (either on or off) would cancel the rule. So lets say it's before the 10 mins pushing on to 100% would end the rule...

Switch attribute goes to off when level is set to 0 but I see what you mean... I'll take a look..

Right; my question is why your rule is looking for level to be 0 (which probably will never be true) instead of switch to be off.

EDIT: I guess it would also be good to clarify what those actions are intended to do if you haven't already. :slight_smile:

When set level 0, last level is still set (meaning if I manually set level to 50 on the switch and set level to 0 to turn it off, last level isn't affected) That said, heres a screen shot of my options. As you can see it doesn't give options for on/off or even switch attribute. Perhaps this is something @bravenel could look into for a future RM release