Why is my logic (brain) so fuzzy?

Richard & other folks,

I’m creating simple sample PLEGs to help me learn. I’m having a problem with a hall light that I want to use as a night light. Physically, the device is an incandescent bulb controlled using an Aeotec microswitch dimmer, wired behind a standard single pole toggle.

I understand with this hardware combination, the single pole toggle will only turn on / turn off the fixture. Dimming has to be done through Vera.

My goal is:

22:00 to 07:00 - automatically dim the light to 20% (this works)

But: if one of the children manually turn on the switch, set the dim level to 50% for 15 minutes, then go back to 20% (this also works)

While the level is at 50%, not waiting the 15 minutes, if they manually flip the switch, set the level back to 20% (This is NOT working) What is happening is, the light ramps down to 20%, then immediately ramps back up to 50%

I think I have a problem understanding my own logic in conflict with the way PLEG works.

Would you take a look at my status (attached) & help me understand it correctly?

Thanks,

Chris

I assume you have instant status reporting light!

If the Hall Light is turned OFF manually at night the following happens:

  1. The LightOff Input Triggers triggers.
  2. The HallOffNight Condition Fires … because it becomes true
    The action for this set’s the light’s LoadLevelTarget to 20%
  3. The LightOn Input Triggers … because the Light was off for a few milli seconds.
  4. The HallOnNight Condition Fires
    The actions for this set’s the light’s LoadLevelTarget to 50%

To break this cycle … you probably need something like:
HallOnNight LightOn and NightLight and (LightOff;LightOn > 5)
This will only consider this a LightOn event if the light was off for at least 5 seconds.

The problem with this (and your previous solution) is you manually Dim the lights above 20% they stay there.

So maybe you need another input:
LightLevelStatus Bound to light Level;

Then a condition:
LowerLamp NightLight and (LightLevelStatus > 20) and (LightLevelStatus; NOW > 15:00)

Then you can remove the delayed action from HallOnNight and move it LowerLamp
This will fire weather the lamp is automatically turned on or manually moved above 20% 15 minutes later.

Thanks Richard, the switch does support instant status, and it appears to be reporting manual status instantly.

[quote=“RichardTSchaefer, post:2, topic:177680”]. . .
3) The LightOn Input Triggers … because the Light was off for a few milli seconds.
. . .[/quote]

That’s exactly the way it is happening!
I guessed the problem had to do with step 3 above, but the the way you lay it out for me, I can now see how the problem starts.

So maybe you need another input: LightLevelStatus Bound to light Level;

I was starting to think along these lines, There is an unused input Device Property called “Level” bound to the LoadLevelStatus in this PLEG, but I didn’t incorporate it into any conditions yet. I’ll rename it to LightLevelStatus and create a condition:
LowerLamp NightLight and (LightLevelStatus > 20) and (LightLevelStatus; NOW > 15:00)
. . . and see what happens.

Thanks for the help, I’ve read all of the PLEG sections in the forum. You are answering these same kinds of questions over & over. It’s just hard for a newbie to understand what you are talking about without understanding the logic & flow of your program. So I must practice, practice practice!

Another note: On your website I did find (and actually understand) your note about condition name starting with an underscore. That helped fix another problem I was having with a separate simple PLEG I was testing regarding PIN code entries in my Schlage motorized deadbolt.
So, thanks again!

Chris