After spending the best part of the day on this, I’ve simplified it to 1 trigger operating the lights.
(yes plural, thats both of the little devils)…
at least there is a win…
However,
No matter what code I write, I just can’t get a timer function to work.
Program Logic : MotionTrip ; (Now > 0:04:00): Invalid Value token: 0:04:00
or
Program Logic : MotionTrip ; (Now > 4:00): Invalid Value token: 4:00
It just doesn’t like the value.
Report.
Triggers
Name Description
KitchenOn Kitchen LED is turned on
UpstairsOn Upstairs Entry is turned on
Motiontrip Entry 4 in 1 sensor (motion) is tripped
Schedules
Name Type Time Days
Conditions
Name Expression
LightsOn MotionTrip
Light1Off MotionTrip; (Now > 3:00)
Light2Off MotionTrip ; (Now > 4:00)
Actions
Actions for Condition: LightsOn
Device Action Arguments
Upstairs Entry SetLoadLevelTarget newLoadlevelTarget=100
Kitchen LED SetTarget newTargetValue=1
Actions for Condition: Light1Off
Device Action Arguments
Kitchen LED SetTarget newTargetValue=0
Actions for Condition: Light2Off
Device Action Arguments
Upstairs Entry SetLoadLevelTarget newLoadlevelTarget=0
Light1Off MotionTrip; (Now > 3:00)
Light2Off MotionTrip ; (Now > 4:00)
The brackets are wrong. It should be:
Light1Off (MotionTrip; Now > 3:00)
Light2Off (MotionTrip; Now > 4:00)
The brackets are not necessary at all in this simplified expression but they will do no harm - in the right place. 
No error message now, but…neither are switching off.
Tried with and without brackets, no success.
relevent snippet of Log as follows.
50 04/16/13 17:25:44.101 luup_log:46: PLEG:46:EvalTriggers:Name:KitchenOn State:true Device:33 <0x2bcd7680>
50 04/16/13 17:25:44.101 luup_log:46: PLEG:46:EvalTriggers:Name:UpstairsOn State:true Device:41 <0x2bcd7680>
50 04/16/13 17:25:44.102 luup_log:46: PLEG:46:EvalTriggers:Name:Motiontrip State:false Device:34 <0x2bcd7680>
50 04/16/13 17:25:44.103 luup_log:46: PLEG:46:EvalConditions:Condition:LightsOn Trigger:NOW Result:false <0x2bcd7680>
50 04/16/13 17:25:44.104 luup_log:46: PLEG:46:EvalConditions:Condition:Light1Off Trigger:NOW Result:true <0x2bcd7680>
50 04/16/13 17:25:44.105 luup_log:46: PLEG:46:EvalConditions:Condition:Light2Off Trigger:NOW Result:true <0x2bcd7680>
02 04/16/13 17:25:45.259 ZW_Send
I’m no expert but if I’m reading that correctly, it shows that the condition has been fulfilled and the lights should be off-------but they aren’t… ???
This fragment of the log doesn’t give the full picture. The lack of any action suggests that Light1Off and Light2Off were already true - which is what I would expect given that MotionTrip will happen a lot regardless of the state of the lights. If you capture the log from just before the LightsOn trigger happens, you should see what’s going on.
Now in an earlier post, I suggested the conditions should be:
Light1Off KitchenOn and (LightsOn; Now > 3:00)
Light2Off UpstairsOn and (LightsOn; Now > 4:00)
I still think that is what you need.
Nup, using those conditions no lights come on.
Rex, I tried that combination when you first suggested it with no luck, at least with the KitchenOn and UpstairsOn deleted the lights trigger albeit without a timer.
Attached complete log and Report using your suggestions, email #2 is the log withoutKitchenOn and UpstairsOn for comparison :
Triggers
Name Description
KitchenOn Kitchen LED is turned on
UpstairsOn Upstairs Entry is turned on
Motiontrip Entry 4 in 1 sensor (motion) is tripped
Schedules
Name Type Time Days
Conditions
Name Expression
LightsOn MotionTrip
Light1Off KitchenOn and (MotionTrip; Now > 3:00)
Light2Off UpstairsOn and (MotionTrip; Now > 4:00)
Actions
Actions for Condition: LightsOn
Device Action Arguments
Upstairs Entry SetLoadLevelTarget newLoadlevelTarget=100
Kitchen LED SetTarget newTargetValue=1
Actions for Condition: Light1Off
Device Action Arguments
Kitchen LED SetTarget newTargetValue=0
Actions for Condition: Light2Off
Device Action Arguments
Upstairs Entry SetLoadLevelTarget newLoadlevelTarget=0
Report and Log for PLEG discussed above.
Triggers
Name Description
KitchenOn Kitchen LED is turned on
UpstairsOn Upstairs Entry is turned on
Motiontrip Entry 4 in 1 sensor (motion) is tripped
Schedules
Name Type Time Days
Conditions
Name Expression
LightsOn MotionTrip
Light1Off MotionTrip; Now > 3:00
Light2Off MotionTrip; Now > 4:00
Actions
Actions for Condition: LightsOn
Device Action Arguments
Upstairs Entry SetLoadLevelTarget newLoadlevelTarget=100
Kitchen LED SetTarget newTargetValue=1
Actions for Condition: Light1Off
Device Action Arguments
Kitchen LED SetTarget newTargetValue=0
Actions for Condition: Light2Off
Device Action Arguments
Upstairs Entry SetLoadLevelTarget newLoadlevelTarget=0
Very strange. In the first log, there is no sign of the MotionTrip trigger from device 34. I don’t see how changing a PLEG condition expression can cause this unless it triggered an action that bypassed the sensor at an earlier point. That doesn’t show in your PLEG report, though.
In the second log, the conditions seem to be evaluated correctly and the Light1Off and Light2Off conditions are firing but the actions are missing. Unfortunately some of the details have been cut off by the PDF.
I think we need RichardTSchaefer to take a look at the logs but he will need to see the whole log at full width. He may not see this thread so post in the main Program Logic Plugins category with a link to this.
My next move would be to make a new PLEG with VirtualSwitch devices for all inputs and outputs and get the logic working with that. Then I would shift the actions to the lights, one at a time. Then I would replace the VS triggers with those from the lights and finally add the Motion detector back. If it stops working, you’ll know what to investigate.
It sure looks like the PLEG is in Bypass mode.
Make sure you ARM the PLEG device.
If you search for: TriggerCondition
You will see it satisfied the following conditions in order:
Light1Off
LightsOn
Light1Off
Light2Off
But there are NO: FireAction in the log file.
If it is armed, the disarm it and re-arm it.
If you never armed the PLEG, then I believe it’s neither armed or bypassed and PLEG will treat it as bypassed.
Give the man a beer…I take my hat off to you, sir 
It works…
You (RTS) have provided the working solution, thank you both (Rex & RTS) for your time and trouble in nutting out the problem.
Are there any in-depth instructions on using PLEG, such as the ARMED and BYPASS Mode , I look forward to learning more.
+1