PLEG lock question

Ok, So I have PLEG currently locking my door if it is left unlocked for 10 minutes, unless I am in party mode (in which case I like it to be left unlocked as people will be coming and going and I don’t want it to be a hassle). Party mode is handled by a scene in which I set a virtual switch to “on” and check this in my PLEG conditions

However, I currently have a scene setup to turn on the foyer light whenever any pin is entered to open the door. It works great, but I was curious if it would be possible to do this in PLEG (so that don’t just have a scene for unlocking the door). My foyer is always dark, so I don’t care about day or night. I tried using:

(DoorUnlockedByPin;NOW < 1)

but as everyone probably knows, this can take up to a minute. I want the light to turn on immediately. I even tried just:

DoorUnlockedByPin

but that is always true (after the first time it is unlocked by a pin).

My guess is that maybe a sequence would work where I add another condition of DoorLocked and do

DoorLocked;DoorUnlockedByPin

but that doesn’t work as well. I would this work though since it says “if the door is locked, then the door is unocked by a pin, do X”?

So then I thought maybe I could do the comparison between the two using dates, but I can’t for the life of me think of how to do this, since I don’t really care about the time between the states, just that it was locked then unlocked by a pin. I would like it to be almost instant. If a scene is the best way to handle it, then I’ll keep the scene, but PLEG has really intrigued me and I’m more just curious to know if it’s possible.

The Following will work:

Condition:
_AnyConditionNameThatStartsWithUnderscore DoorUnlockedByPin

There is some special handling when the condition names starts with an underscore … It will fire Every time the triggers that are part of it fire and the result is true … Not just when it turns from False to True.

Thanks Richard! That did the trick :slight_smile: