Rubbish with time delays

I’m after some help with a pleg if possible.

I have a outside shed light on a pir.
I have a pleg that turns on the kitchen light as soon as the outside light is on. Great.
How do I turn the kitchen off though in case it’s a mouse etc.

I would like to wait 5mins then, if the back door or the kitchen pir sensor hasn’t tripped, then turn the kitchen light off.

How do I do that delay and check?
Thanks.

Define a Schedule with OnType: SelfReTrigger and OffType: Interval, 00:05:00

In the Actions for the Condition that turns on the light, add one for PLEG to start the new timer.

Add a Condition that checks if the timer has stopped and whether the motion detectors have tripped recently. Set the Action for that to turn off the kitchen light.

Something like:

Schedules
Timer5M OnType: SelfReTrigger OffType: Interval, 00:05:00

Conditions
DoLightOn
DelayedCk !Timer5M and (DoLightOn; !Timer5M) and (Motion; !Timer5M > 5:00) and …

Actions
DoLightOn
PLEG StartTimer timerName=Timer5M
DelayedCk Turn off kitchen light

You could also detect trips from the door and PIR and restart the timer so that the light stays on until all motion has stopped for five minutes.

In the Actions for the Condition that turns on the light, add one for PLEG to start the new timer.

How do you do that?
Editing the action only brings up the whole Vera device page, not the schedules from inside the same PLEG.

[quote=“thetwc, post:3, topic:185962”] In the Actions for the Condition that turns on the light, add one for PLEG to start the new timer.

How do you do that?
Editing the action only brings up the whole Vera device page, not the schedules from inside the same PLEG.[/quote]

If your on ui5 which sounds like you are. Then you need to click the advanced tab at the top in the orange section.

Triggers Name Description shedon Shed Light is turned on

Schedules
Name On Type On Time On Days Random On Delay Off After Type Off Time Off Days Random Off Delay
s1 Self ReTrigger None Interval 00:05:00 None

Device Properties
Name Device Name Device Variable
bdoor Back Door Tripped
knmotion Fib Sensor Tripped
lighten Shed Light Status

Conditions
Name Repeat Expression
WorktopsOn No (shedon==1)
Timeout No (s1==0)
motioncheck No (bdoor==1) OR (knmotion==1)

Actions
Actions for Condition: Timeout
Device Actions:
Immediate
Device Action Arguments
Worktops SetTarget newTargetValue=0

Actions for Condition: WorktopsOn
Device Actions:
Immediate
Device Action Arguments
Worktops SetTarget newTargetValue=1
outdoor light do kitchen StartTimer timerName=s1 intervalTime=00:05:00

Getting there.
Yes, i’m on UI5, hated UI7 and the thermostat issue is a deal breaker for me.

So i have the outside light triggering the inside worktop/kitchen light.
After 5 mins, the kitchen light will go off. Perfect.

How do add the conditions though?
If the back door opens, or there is motion in the kitchen, another scene triggers the worktops to go on.
I don’t want the worktops to switch off after 5 mins if i’m still in the room or opened the back door.

Is there a way to cancel the timer and don’t turn off the light if there is kitchen motion or back door opens within the 5 mins?

Thank you so much.

Is there a way to cancel the timer and don't turn off the light if there is kitchen motion or back door opens within the 5 mins?

You cannot cancel the timer but you can ignore it when it ends. See my earlier example which included additional logic to do just that.

Sorry, it’s just i don’t understand that 2nd condition, so i was trying to make it work with my BBC BASIC programming.

Triggers Name Description shedon Shed Light is turned on

Schedules
Name On Type On Time On Days Random On Delay Off After Type Off Time Off Days Random Off Delay
s1 Self ReTrigger None Interval 05:00 None

Device Properties
Name Device Name Device Variable
bdoor Back Door Tripped
coffer RFx Coffer Status
knmotion Fib Sensor LastTrip
lighten Shed Light Status
loungeOR Lounge LightORide Status

Conditions
Name Repeat Expression
WorktopsOn No (shedon==1)
Timeout No !s1 AND (WorktopsOn; !s1) AND (knmotion; !s1 < 5:00)
Lounge No (coffer==0) AND (shedon==1) AND (loungeOR==0)
Actions

Actions for Condition: Lounge
Device Actions:
Immediate
Device Action Arguments
RFx Coffer SetLoadLevelTarget newLoadlevelTarget=100
RFx Table Light SetLoadLevelTarget newLoadlevelTarget=100
L Light Timer RestartTimer

Actions for Condition: Timeout
Device Actions:
Immediate
Device Action Arguments
Worktops SetTarget newTargetValue=0

Actions for Condition: WorktopsOn
Device Actions:
Immediate
Device Action Arguments
Worktops SetTarget newTargetValue=1
outdoor light do kitchen StartTimer timerName=s1 intervalTime=00:05:00

!s1 AND (WorktopsOn; !s1) AND (knmotion; !s1 < 5:00)
Doesn't seem to be working.
Quote !s1 AND (WorktopsOn; !s1) AND (knmotion; !s1 < 5:00) Doesn't seem to be working.

If you switch the worktop lights on by other means, you need to have logic to detect that in the Condition. Try something like this:

 !s1 AND (WorktopsOn; !s1) AND (knmotion; !s1 > 5:00) AND (bdoor; !s1 > 5:00)

Explanation:

This expression becomes true when the timer s1 has ended, it ended after the Condition WorktopsOn last became true (which started the timer), it ended at least 5 minutes since knmotion was last true and it ended at least five minutes after bdoor last became true.

If you place the logic to turn on the worktop lights when the door opens or motion is detected in the same PLEG, you could simplify this a little.