Issue with Light going off when Night arrives

Hello,

I created a PLEG Awhile back that controls my flood lights and a kitchen light, all is working well except if the kitchen light is on and night arrives it turns the light off and then I have to turn it back on, really annoying.

House Lighting

Device ID: 512014-03-14 11:16:31.067 PLC Version: 6.3

Registration

You have 1 licenses, which allows for 4 PLEG and/or PLTS plugins.

Triggers

Name	Description	State	Last True	Last False
BackDoorUnlock	 PIN Code #* is entered on Back Door	true	2014-03-12 22:39:58.486	0
Night	 Day or Night indicates Night time.	false	2014-03-13 19:12:46.025	2014-03-14 07:21:01.108
BackDoorLock	Back Door: Lock button is pressed	true	2014-03-11 17:35:47.563	0
WD_Scene1	 WD Controller: scene number 1 is activated	false	0	0
Schedules

Name	Type	Time	Days	Random On Delay	Off After Type	Off Time	Off Days	Random Off Delay	State	Last On	Last Off
LightOffSched	Weekly	23:30:00	1,2,3,4,5,6,7	None	None			None	false	2014-03-13 23:30:00.101	0
Conditions

Name	Repeat	Expression	State	Last True	Last False
FloodOn	No	Night	false	2014-03-13 19:12:46.026	2014-03-14 07:21:01.118
FloodOff	No	not Night or LightOffSched	true	2014-03-13 23:30:00.104	2014-03-13 19:12:46.030
_KitchenOn	Yes	Night and BackDoorUnlock	false	2014-03-13 19:12:46.031	2014-03-14 07:21:01.122
_KitchenOff	Yes	Night and BackdoorLock	false	2014-03-13 19:12:46.065	2014-03-14 07:21:01.123
Actions

Actions for Condition: _KitchenOn

Immediate

Device	Action	Arguments
Kitchen Lights	SetTarget	 newTargetValue=1
Actions for Condition: _KitchenOff

Immediate

Device	Action	Arguments
Kitchen Lights	SetTarget	 newTargetValue=0
Actions for Condition: FloodOn

Immediate

Device	Action	Arguments
G_Flood Light	SetTarget	 newTargetValue=1
Flood_Lights	SetTarget	 newTargetValue=1
Actions for Condition: FloodOff

Immediate

Device	Action	Arguments
Flood_Lights	SetTarget	 newTargetValue=0
G_Flood Light	SetTarget	 newTargetValue=0

Also I have a WD Wireless Gateway that I would like to integrate as well in the following way, not sure if this is possible though. Setup scene 1 to turn off kitchen light if it is on and if the light is off then turn it on.

is is because BackdoorLock, once triggered it remains true. you can see in the report, it has been true for two days.

you need to set the condition to trap the event at the moment you want it to fire.

_KitchenOff = Night and BackdoorLock and (BackdoorLock; NOW<1:30)

this will turn off the light if it is night the door is now locked and the door was just locked.

Bulldog I implemented the logic you proposed but now if the light is not on and night arrives it turns it on. I have come home late at night to find the light has been on for hours, any suggestions?

Sent from my SCH-I535 using Tapatalk

can you post your status report again?

Here is my latest Status Log:

House Lighting

Device ID: 512014-03-21 16:39:56.699 PLC Version: 6.3

Registration

You have 1 licenses, which allows for 4 PLEG and/or PLTS plugins.

Triggers

Name	Description	State	Last True	Last False
BackDoorUnlock	 PIN Code #* is entered on Back Door	true	2014-03-21 15:37:48.114	0
Night	 Day or Night indicates Night time.	false	2014-03-20 19:19:58.119	2014-03-21 07:09:47.114
BackDoorLock	Back Door: Lock button is pressed	true	2014-03-21 08:01:37.291	0
Schedules

Name	Type	Time	Days	Random On Delay	Off After Type	Off Time	Off Days	Random Off Delay	State	Last On	Last Off
LightOffSched	Weekly	23:30:00	1,2,3,4,5,6,7	None	None			None	false	2014-03-20 23:30:00.106	0
Conditions

Name	Repeat	Expression	State	Last True	Last False
FloodOn	No	Night	false	2014-03-20 19:19:58.120	2014-03-21 07:09:47.115
FloodOff	No	not Night or LightOffSched	true	2014-03-20 23:30:00.109	2014-03-20 19:19:58.124
_KitchenOn	Yes	Night and BackDoorUnlock	false	2014-03-20 19:19:58.125	2014-03-21 15:37:48.117
_KitchenOff	Yes	Night and BackdoorLock and (BackdoorLock; NOW <1:30)	false	2014-03-20 07:07:22.105	2014-03-21 15:37:22.106
Actions

Actions for Condition: _KitchenOn

Immediate

Device	Action	Arguments
Kitchen Lights	SetTarget	 newTargetValue=1
Actions for Condition: _KitchenOff

Immediate

Device	Action	Arguments
Kitchen Lights	SetTarget	 newTargetValue=0
Actions for Condition: FloodOn

Immediate

Device	Action	Arguments
G_Flood Light	SetTarget	 newTargetValue=1
Flood_Lights	SetTarget	 newTargetValue=1
Actions for Condition: FloodOff

Immediate

Device	Action	Arguments
Flood_Lights	SetTarget	 newTargetValue=0
G_Flood Light	SetTarget	 newTargetValue=0

Here is my latest Status Log:

[code]
House Lighting

Device ID: 512014-03-21 16:39:56.699 PLC Version: 6.3

Registration

You have 1 licenses, which allows for 4 PLEG and/or PLTS plugins.

Triggers

Name Description State Last True Last False
BackDoorUnlock PIN Code #* is entered on Back Door true 2014-03-21 15:37:48.114 0
Night Day or Night indicates Night time. false 2014-03-20 19:19:58.119 2014-03-21 07:09:47.114
BackDoorLock Back Door: Lock button is pressed true 2014-03-21 08:01:37.291 0
Schedules

Name Type Time Days Random On Delay Off After Type Off Time Off Days Random Off Delay State Last On Last Off
LightOffSched Weekly 23:30:00 1,2,3,4,5,6,7 None None None false 2014-03-20 23:30:00.106 0
Conditions

Name Repeat Expression State Last True Last False
FloodOn No Night false 2014-03-20 19:19:58.120 2014-03-21 07:09:47.115
FloodOff No not Night or LightOffSched true 2014-03-20 23:30:00.109 2014-03-20 19:19:58.124
_KitchenOn Yes Night and BackDoorUnlock false 2014-03-20 19:19:58.125 2014-03-21 15:37:48.117
_KitchenOff Yes Night and BackdoorLock and (BackdoorLock; NOW <1:30) false 2014-03-20 07:07:22.105 2014-03-21 15:37:22.106
Actions

Actions for Condition: _KitchenOn

Immediate

Device Action Arguments
Kitchen Lights SetTarget newTargetValue=1
Actions for Condition: _KitchenOff

Immediate

Device Action Arguments
Kitchen Lights SetTarget newTargetValue=0
Actions for Condition: FloodOn

Immediate

Device Action Arguments
G_Flood Light SetTarget newTargetValue=1
Flood_Lights SetTarget newTargetValue=1
Actions for Condition: FloodOff

Immediate

Device Action Arguments
Flood_Lights SetTarget newTargetValue=0
G_Flood Light SetTarget newTargetValue=0
[/code][/quote]

same problem with the light on condition…

_KitchenOn Night and BackDoorUnlock

Instead, use:

_KitchenOn = BackDoorUnlock AND Night AND (Night;BackDoorUnlock)

will become true if the door is unlocked at night and if night happened before the door is unlocked.

You getting it?

Here is my latest Status Log:

[code]
House Lighting

Device ID: 512014-03-21 16:39:56.699 PLC Version: 6.3

Registration

You have 1 licenses, which allows for 4 PLEG and/or PLTS plugins.

Triggers

Name Description State Last True Last False
BackDoorUnlock PIN Code #* is entered on Back Door true 2014-03-21 15:37:48.114 0
Night Day or Night indicates Night time. false 2014-03-20 19:19:58.119 2014-03-21 07:09:47.114
BackDoorLock Back Door: Lock button is pressed true 2014-03-21 08:01:37.291 0
Schedules

Name Type Time Days Random On Delay Off After Type Off Time Off Days Random Off Delay State Last On Last Off
LightOffSched Weekly 23:30:00 1,2,3,4,5,6,7 None None None false 2014-03-20 23:30:00.106 0
Conditions

Name Repeat Expression State Last True Last False
FloodOn No Night false 2014-03-20 19:19:58.120 2014-03-21 07:09:47.115
FloodOff No not Night or LightOffSched true 2014-03-20 23:30:00.109 2014-03-20 19:19:58.124
_KitchenOn Yes Night and BackDoorUnlock false 2014-03-20 19:19:58.125 2014-03-21 15:37:48.117
_KitchenOff Yes Night and BackdoorLock and (BackdoorLock; NOW <1:30) false 2014-03-20 07:07:22.105 2014-03-21 15:37:22.106
Actions

Actions for Condition: _KitchenOn

Immediate

Device Action Arguments
Kitchen Lights SetTarget newTargetValue=1
Actions for Condition: _KitchenOff

Immediate

Device Action Arguments
Kitchen Lights SetTarget newTargetValue=0
Actions for Condition: FloodOn

Immediate

Device Action Arguments
G_Flood Light SetTarget newTargetValue=1
Flood_Lights SetTarget newTargetValue=1
Actions for Condition: FloodOff

Immediate

Device Action Arguments
Flood_Lights SetTarget newTargetValue=0
G_Flood Light SetTarget newTargetValue=0
[/code][/quote]

same problem with the light on condition…

_KitchenOn Night and BackDoorUnlock

Instead, use:

_KitchenOn = BackDoorUnlock AND Night AND (Night;BackDoorUnlock)

will become true if the door is unlocked at night and if night happened before the door is unlocked.

You getting it?[/quote]

I’m not following the code you presented, however I just added the second part and will see if it fixes my issue, thanks again.

Bulldoglowell:

I have added additional Logic to turn on the kitchen light automatically when a motion sensor is tripped, this is working great with one exception. If the light is on becuase it was tripped by the motion sensor and I go to leave and lock the door the light will not turn off until the motion timer times out, can you provide some insight on how to fix this issue?

*Note: All changes I made to this PLEG are in blue.

[sub]
House Lighting

Device ID: 512014-04-01 09:14:35.850 PLC Version: 6.5

Registration

You have 1 licenses, which allows for 4 PLEG and/or PLTS plugins.
Your license key is:
Triggers

Name Description State Last True Last False
BackDoorLock Back Door: Lock button is pressed true 2014-04-01 04:59:57.006 0
BackDoorUnlock PIN Code #* is entered on Back Door true 2014-04-01 06:06:21.210 0
KitchenLightOn Kitchen Lights is turned on false 2014-04-01 06:50:26.753 2014-04-01 07:28:31.871
KitchenMotion Kitchen Motion is tripped false 2014-04-01 07:35:13.718 2014-04-01 09:08:52.195
Night Day or Night indicates Night time. false 2014-03-31 19:31:05.115 2014-04-01 06:52:05.037

Schedules

Name On Type On Time On Days Random On Delay Off After Type Off Time Off Days Random Off Delay State Last On Last Off
KitchenTimer Self ReTrigger None Interval 05:00 None false 2014-04-01 07:18:30.527 2014-04-01 07:28:30.100
LightOffSched Weekly 23:30:00 1,2,3,4,5,6,7 None None None false 2014-03-31 23:30:00.109 0

Conditions

Name Repeat Expression State Last True Last False

FloodOn No Night false 2014-03-31 19:31:05.116 2014-04-01 06:52:05.038
FloodOff No not Night or LightOffSched true 2014-03-31 23:30:00.112 2014-03-31 19:31:05.120
_KitchenOn Yes BackDoorUnlock AND Night AND (Night;BackDoorUnlock) false 2014-04-01 06:06:21.216 2014-04-01 06:52:05.048
_KitchenOff Yes Night and BackdoorLock and (BackdoorLock; NOW < 10) false 2014-03-31 04:55:31.108 2014-04-01 09:08:47.745
KitchenAutoOn No !KitchenLightOn and Night and KitchenMotion and (!KitchenLightOn; KitchenMotion > 30) false 2014-04-01 06:50:25.021 2014-04-01 06:50:26.762
KitchenAutoOff No KitchenLightOn and !KitchenTimer and (KitchenLightOn; !KitchenTimer) and (!KitchenLightON; KitchenLightOn > 10) false 2014-04-01 07:28:30.118 2014-04-01 07:28:31.886
KeepKitchenOn No (KitchenLightOn and KitchenMotion and (KitchenLightOn; KitchenMotion)) or KitchenAutoOn false 2014-04-01 07:18:30.491 2014-04-01 07:18:32.471

Actions

Actions for Condition: _KitchenOff

Immediate

Device Action Arguments
Kitchen Lights SetTarget newTargetValue=0

Actions for Condition: _KitchenOn

Immediate

Device Action Arguments
Kitchen Lights SetTarget newTargetValue=1

Actions for Condition: FloodOff

Immediate

Device Action Arguments
Flood_Lights SetTarget newTargetValue=0
G_Flood Light SetTarget newTargetValue=0

Actions for Condition: FloodOn

Immediate

Device Action Arguments
G_Flood Light SetTarget newTargetValue=1
Flood_Lights SetTarget newTargetValue=1

Actions for Condition: KeepKitchenOn

Immediate

Device Action Arguments
House Lighting StartTimer timerName=KitchenTimer intervalTime=

Actions for Condition: KitchenAutoOff

Immediate

Device Action Arguments
Kitchen Lights SetTarget newTargetValue=0

Actions for Condition: KitchenAutoOn

Immediate

Device Action Arguments
Kitchen Lights SetTarget newTargetValue=1

[/sub]

That gets very tricky … because in general you want the lights to be on while there is motion.

You can lower the “ON” time of your motion sensor.

[quote=“RichardTSchaefer, post:9, topic:180176”]That gets very tricky … because in general you want the lights to be on while there is motion.

You can lower the “ON” time of your motion sensor.[/quote]

Richard, thanks for the reply and suggestion. I was not sure if there was a way in PLEG to stop using the timer when the door lock button is pressed which would then turn the light off.

You can always turn the light off when the door lock button is pressed.
So what if it turns off again a few minutes later.