Logic for motion lights

Trying to get a feel for how I want my motion detector to turn on lights. For example, if I am using it in the living room, I’d want:

  • motion to turn on the lights, if no motion after 20 mins, turn off.
  • if I turn on the lights manually (wall or via VeraUI), turn off after 30 mins

RicharTSchaefer posted this in another topic and I am trying to figure out the details

Input Trigger:
Night Day or Night Indicates Night
Motion Motion sensor Tripped
LightOn Light is turned On Does this mean that the light is on, rather than someone turning it on?

Conditions:
TurnLightOn (Not LightOn) and Motion and Night The light is not already on, there is motion detected, and it’s night
AutoOnDetected TurnLightOn; LightOn < 1:00 ?
TurnLightOff (Not Motion) and AutoOnDetected and (AutoOnDetected; Now > 3:00)

Actions:
TurnLightOn Commands to turn light(s) on
TurnLightOff Commands to turn light(s) off

If I can figure out those questions above, I think I can get this working…

The LightOn Input only knows the light is on … it does not know why it’s on … could be a person turned it on … could be a scene or this PLEG turned it on!

The AutoOnDetected is true when the LightOn turns on within 1 minute of TurnLightOn being tripped. This is how it detects that the light was turned on by this PLEG and not something else.