Light On at Night When Alarm Armed

Looking to try and get an automated condition setup that is seeming to perplex me here. I’ve thought through using a regular scene, but I don’t think it has the AND configurations needed to achieve my goal unless I leverage Lua. Trying to avoid using lua unless absolutely necessary.

Configured Devices:
Ademco AD2USB hooked to my Vista Alarm only 1 partition
Door sensor (hooked through alarm) on garage door
Day or Night app for determining time day/night

TRIGGER
GarageDoor = Garage door sensor is tripped
Night = Day or Night app is set to Night

PROPERTIES
ArmMode =Alarm armed is either Armed / Disarmed

CONDITION
AutoOn = ArmMode eq ‘Armed’ AND Night AND GarageDoor

ACTIONS
AutoOn = turn kitchen light on

I’ve seen other variations that involve the action in a sequence and tried. My results have been varied and any time it has successfully worked 1 of 2 things would always be the case: The kitchen light would also turn on anytime the Alarm status changed to Armed, or this would only successfully work one time, then would not work again until I reboot the vera. Any help is greatly appreciated as this piece has been haunting me for multiple nights now.

This is just the first building block I hope to learn from, my end goal is to produce the following logic:
At night, if the alarm is currently armed, AND the garage door OR front door is tripped, turn on the kitchen light
OR
At night, if the alarm is disarmed (by scene or app) followed by the garage door OR front door tripped, turn on the kitchen light
OR
At night, if the alarm is currently disarmed, AND no other lights are on downstairs, AND garage door OR front door is tripped, turn on the kitchen light

You did not say … but it is implied from the context that you are having problems with PLEG not working as expected.

Have you used the Status command to help understand why/when things are happening ? It sounds like you Garage door in always indicating tripped.

For PLEG help … please post your complete status report.

Richard,

Yes my apologies, I must have removed that line when I was fixing the post. PLEG is the goal here. I’m thinking I will be setting up multiple timed automations (per my longer list) into one PLEG device.

I don’t know if perhaps it just needed you to talk to. I just went through and put the configuration back in to pull the status report for you and it seems testing it out it’s working. I’m going to try and do some more testing and see how it comes out. Perhaps I won’t need help and your plugin is working perfectly, which is my hope.

I guess in anticipation of things working properly, can you advise on the ordered schedule I illustrated with the ordered events. Is the proper Condition that I need:

TRIGGER
Disarm = alarm is disarmed
GarageDoor = garage door tripped
Night = day or night is set to night

Night AND Disarm;Night

Night AND Disarm;Night

This will be true when NIGHT is detected and the alarm was previously turned off.

NOTE: If the alarm was turned off Yesterday … it will still be true when it becomes night TODAY.

Maybe I need to re-read everything I type. ::slight_smile:

What I meant for the Condition was:

Night AND Disarm; GarageDoor

Thinking about the Note you made, would I be better off then to use something like:

Night AND Disarm; GarageDoor <15:00

If my understanding is correct, this would trigger if Night and Disarm is followed by the GarageDoor trip within 15 minutes. If Disarmed at night and GarageDoor isn’t tripped within 15 minutes, it would essentially reset the scene evaluation?

First, thank you again Richard for your guidance. Much appreciated as always.

Ok, think I’ve gotten this ironed out as my tests seem to be working. See the configuration I have setup below. Basic premise: if the alarm is armed and either front/garage door is opened, a light will come on. If the alarm is disarmed, and the front/garage door is opened within 3 minutes, a light will come on. My question now, is there a way to build in an ignore if one condition already happened? Right now if I disarm the alarm, come in the front door, the hall light comes on. If within 3 minutes of disarming the alarm I open the garage door (take out the trash maybe) the kitchen table light also comes on. I’d like to suppress the second condition becoming true. Am I able to use another Condition Variable within the condition? i.e. (AND CAutoOnFront ne ‘True’)

TRIGGERS
TGarageDoor Zone #11 - Garage Door is tripped
TNight DayorNight indicates Night time.
TFrontDoor Zone #9 - Front Door is tripped
TDisarmed Ademco Vista Partition 1 is DISARMED

DEVICE PROPERTIES
TArmMode Ademco Vista Partition 1 ArmMode
TDetailArmMode Ademco Vista Partition 1 DetailedArmMode

CONDITIONS
CAutoOnGarage (TNight AND (TArmMode eq ‘Armed’ AND TGarageDoor)) OR (TNight AND (TDisarmed;TGarageDoor<3:00))
CAutoOnFront (TNight AND (TArmMode eq ‘Armed’ AND TFrontDoor)) OR (TNight AND (TDisarmed;TFrontDoor<3:00))

ACTIONS
Actions for Condition: CAutoOnFront
Front Hall SetTarget newTargetValue=1

Actions for Condition: CAutoOnGarage
Kitchen Table SetTarget newTargetValue=1

Am I able to use another Condition Variable within the condition? i.e. (AND CAutoOnFront ne 'True')

Yes, In fact a condition can reference itself in a condition … in that case it’s the previous conditions value and time that are used.

If you reference a previously defined condition … it is based on the current evaluation … If you reference a condition after the current one … it will use the values and time stamp from the previous evaluation.

I think I get that. Now I’ve just discovered I have a flaw in the logic I’ve programmed which may be relevant to your point about current evaluation vs previous evaluation. Based on the shot below, when I played with the Day/Night switch and everything else in it’s current state, I found my hall light coming on but not the kitchen light, despite the logic being the same. I do notice though that the last evaluation of TFrontDoor and TDisarmed are within 3 minutes of each other. When I arm/disarmed the system, the time updated and suddenly flipping the day/night switch didn’t trip the hall light. Is there something I can fix in the conditions to alleviate potentially hitting this situation?

Triggers
Name Description Last Trigger State
TGarageDoor Zone #11 - Garage Door is tripped 2013-09-20 19:37:06.165 false
TNight DayorNight indicates Night time. 2013-09-20 21:38:05.116 true
TFrontDoor Zone #9 - Front Door is tripped 2013-09-20 18:04:00.275 false
TDisarmed Ademco Vista Partition 1 is DISARMED 2013-09-20 18:03:49.723 true

Conditions
Name Expression Last True State
CAutoOnGarage (TNight AND (TArmMode eq ‘Armed’ AND TGarageDoor)) OR (TNight AND (TDisarmed;TGarageDoor<3:00)) 2013-09-20 18:04:14.470 false
CAutoOnFront (TNight AND (TArmMode eq ‘Armed’ AND TFrontDoor)) OR (TNight AND (TDisarmed;TFrontDoor<3:00)) 2013-09-20 21:38:05.138 true

I am not sure the following is doing what you want:

 OR  (TNight AND (TDisarmed;TFrontDoor<3:00))   

If the front door is opened 3 minutes after disarming at say noon … and you stay home all day … this will be true when night arrives … What exactly do you expect ?

Hmm ya that would be undesired. The goal is to have this only trigger when the door is opened within 3 minutes of disarming after sunset. Basically providing a light in the house (depending on the door) when entering at night time. Could you suggest the better way to write this logic?

Then you want:
OR ((TNight; TDisarmed) AND (TDisarmed;TFrontDoor<3:00))

Richard,

Thank you. Would I need to use the same logic for the previous portion of the OR statement as well:

(TNight AND (TArmMode eq ‘Armed’ AND TGarageDoor))

If the first part meets your objectives … leave it alone.

Richard,

It seems I’m having trouble now with the updated suggestion you made, or perhaps the other part is giving me trouble. So currently I’ve got this in my conditions:

(TNight AND (TArmMode eq ‘Armed’ AND TFrontDoor)) OR ((TNight;TDisarmed) AND (TDisarmed;TFrontDoor<3:00))

I have had a few mornings now where I walk downstairs to let the dog out in the AM. Unlocking my front door enables a disarm of the alarm, and then opening the door triggers the light to come on. I’m not up before the day/night turns to day, so I’m a bit baffled. I’m assuming something must not be picking up properly in the second half as its based on the disarm followed by door sensor not the lock function.

any ideas?

If this happens again … do a status report right away … You can look at later in the morning when you are awake!

Richard,

I actually am able to reproduce this essentially at any time it seems. Just walked downstairs to test it and I can reproduce it over and over now. Understanding the logic, it makes sense why as well:

BEFORE[hr]
TRIGGERS
TNight DayorNight indicates Night time. 2013-10-10 18:19:12.186 false
TDisarmed Alarm Panel is DISARMED 2013-10-11 08:07:19.878 false
TFrontDoor Zone #9 - Front Door is tripped 2013-10-11 08:09:17.803 false

CONDITIONS
CAutoOnFront (TNight AND (TArmMode eq ‘Armed’ AND TFrontDoor)) OR ((TNight;TDisarmed) AND (TDisarmed;TFrontDoor<3:00)) 2013-10-11 08:09:17.814 true

AFTER[hr]
TRIGGERS
TNight DayorNight indicates Night time. 2013-10-10 18:19:12.186 false
TDisarmed Alarm Panel is DISARMED 2013-10-11 09:21:25.659 true
TFrontDoor Zone #9 - Front Door is tripped 2013-10-11 09:21:27.953 false

CONDITIONS
CAutoOnFront (TNight AND (TArmMode eq ‘Armed’ AND TFrontDoor)) OR ((TNight;TDisarmed) AND (TDisarmed;TFrontDoor<3:00)) 2013-10-11 09:21:27.964 true
[hr]
TNight happened yesterday sometime, was followed by TDisarmed this AM when I disarmed it, which was then followed by the front door being opened within 3 minutes. You can also see the last time before was about 8:09 which is when the door was opened to let the dog out and the light went on.

Would my solution be to change TNight to a Device Property instead and leverage (TNight eq ‘Night’ AND (TDisarmed; TFrontDoor<3:00))?

@shmixx
I can’t tell what the problem is because I do not know what you expect the logic to do.
For example a few posts earlier you describe something working for kitchen lights and not for hallway lights … but I can’t see the connection because you did not show the actions …

Please submit a Status report so I can see all of the pieces.

And maybe a description of what you think it is supposed to do and/or what it did that you did not expect.

@richard

Sorry I changed my mind around on the lights that I was using. I decided the front hall and the kitchen table light were good. I’ve essentially got 2 conditions that are the same but one is for the front door, while the other is for the garage door. The goal is to turn on the kitchen table light when the garage door is opened at night, and the alarm is either armed, or was just disarmed within 3 minutes. Same thing for the front door as well, but with a hallway light.

I’ll post the entire status report at your request, but the only pieces that matter (at least as far as I know) I’ve added BOLD font to.

Automation Actions

Device ID: 462013-10-11 14:11:07.596 PLC Version: 5.1

Triggers

Name Description Last Trigger State
TGarageDoor Zone #11 - Garage Door is tripped 2013-10-11 12:51:42.948 false
TNight DayorNight indicates Night time. 2013-10-10 18:19:12.186 false
TFrontDoor Zone #9 - Front Door is tripped 2013-10-11 12:04:10.948 false
TDisarmed Alarm Panel is DISARMED 2013-10-11 09:21:25.659 true

TKitchenIslandOff Kitchen Island is turned off 2013-10-10 19:11:37.205 true
TKitchenOverhead Kitchen Overhead is turned on 2013-10-10 21:42:11.168 false
TFrontUnlock Front Door is opened 2013-10-11 09:34:51.389 false
TFrontPIN PIN Code #* is entered on Front Door 2013-10-10 20:04:22.820 true
TKitchenIslandOn Kitchen Island is turned on 2013-10-10 18:03:55.726 false
TUpstairsHallOn Upstairs Hall is turned on 2013-10-11 13:23:35.747 false
TUpstairsHallOff Upstairs Hall is turned off 2013-10-11 13:25:03.187 true
TArmed Alarm Panel is ARMED 2013-10-11 09:20:12.999 false
TShawnAway ()Destiny is away 2013-10-11 08:38:17.514 false
TShawnHome (
)Destiny is present 2013-10-11 08:39:18.562 true
TBasementMotion Zone #17 - Basement Motion is tripped 0 false
Schedules

Name Type Time Days Random On Delay Off After Type Off Time Off Days Random Off Delay State Last Schedule
TSunset Weekly t 1,2,3,4,5,6,7 None None None false 2013-10-10 18:19:12.101
Device Properties

Name Device Name Device Variable Last Change Value
TArmMode Alarm Panel ArmMode 2013-10-11 09:21:25.706 Disarmed
TDetailArmMode Alarm Panel DetailedArmMode 2013-10-11 12:51:47.068 Ready
Conditions

Name Expression Last True State
CAutoOnGarage (TNight AND (TArmMode eq ‘Armed’ AND TGarageDoor)) OR ((TNight;TDisarmed) AND (TDisarmed;TGarageDoor<3:00)) 2013-10-09 20:46:54.208 false
CAutoOnFront (TNight AND (TArmMode eq ‘Armed’ AND TFrontDoor)) OR ((TNight;TDisarmed) AND (TDisarmed;TFrontDoor<3:00)) 2013-10-11 09:21:27.964 false

CFrontPorchOn TSunset 2013-10-10 18:19:12.141 false
CFrontPorchOff CFrontPorchOn; Now > 4:00:00 2013-10-10 22:19:57.112 true
CKitchenOff TKitchenIslandOff 2013-10-10 19:11:37.221 true
CKitchenOff2 (TKitchenIslandOff @ 2 < 5) OR (TKitchenIslandOn @ 2 < 5) 2013-10-09 20:50:24.999 false
CFrontUnlock TFrontUnlock AND TArmMode eq ‘Armed’ 2013-10-11 09:21:21.317 false
CFrontPIN TFrontPIN 2013-10-04 10:35:35.239 true
CHallAlarm (TUpstairsHallOn @ 2 < 5) OR (TUpstairsHallOff @ 2 < 5) 2013-10-10 21:51:02.929 false
CPhoneMuteOn1 TShawnHome AND (TShawnHome; Now > 5:00) 2013-10-11 08:44:57.121 true
CPhoneMuteOn2 TShawnHome AND (CPhoneMuteOff; Now > 5:00) 2013-10-11 12:56:57.123 true
CPhoneMuteOff TFrontDoor OR TGarageDoor OR TArmed OR TShawnAway 2013-10-11 12:51:42.984 false
CBasementThermoOn TBasementMotion @ 3 < 10:00 0 false

Actions

[b]Actions for Condition: CAutoOnFront

Immediate

Device Action Arguments
Front Hall SetTarget newTargetValue=1
Actions for Condition: CAutoOnGarage

Immediate

Device Action Arguments
Kitchen Table SetTarget newTargetValue=1[/b]
Actions for Condition: CFrontPorchOn

Immediate

Device Action Arguments
Front Porch SetTarget newTargetValue=1
Actions for Condition: CFrontPorchOff

Immediate

Device Action Arguments
Front Porch SetTarget newTargetValue=0
Actions for Condition: CFrontUnlock

Immediate

Device Action Arguments
Alarm Panel RequestArmMode State=Disarmed PINCode=undefined
Actions for Condition: CFrontPIN

Immediate

Device Action Arguments
Alarm Panel RequestArmMode State=Disarmed PINCode=undefined
Actions for Condition: CKitchenOff2

Immediate

Device Action Arguments
Kitchen Table SetTarget newTargetValue=0
Kitchen Island SetTarget newTargetValue=0
Kitchen Overhead SetTarget newTargetValue=0
Actions for Condition: CKitchenOff

Immediate

Device Action Arguments
Kitchen Overhead SetTarget newTargetValue=0
Actions for Condition: CHallAlarm

Immediate

Device Action Arguments
Upstairs Hall SetTarget newTargetValue=0
Alarm Panel RequestQuickArmMode State=Armed
Dining Room SetLoadLevelTarget newLoadlevelTarget=0
Front Hall SetTarget newTargetValue=0
Kitchen Table SetTarget newTargetValue=0
Kitchen Overhead SetTarget newTargetValue=0
Kitchen Island SetTarget newTargetValue=0
Front Door SetTarget newTargetValue=1
Actions for Condition: CPhoneMuteOff

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=0
Actions for Condition: CPhoneMuteOn2

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=1
Actions for Condition: CPhoneMuteOn1

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=1
Actions for Condition: CBasementThermoOn

Immediate

Device Action Arguments
VeraAlerts SendAlert Message=Basement motion tripped Recipients=
Notifications

Name Description Users Last Sent
Front porch lights activated Automation Actions has satisfied condition: CFrontPorchOn xxxxxxxx 2013-10-10 18:19:12.141

CAutoOnGarage TNight AND TGarageDoor AND (TNight;TGarageDoor) AND ((TArmMode eq ‘Armed’) OR (TDisarmed;TGarageDoor<3:00))
CAutoOnFront TNight AND TFrontDoor AND (TNight;TFrontDoor) AND ((TArmMode eq ‘Armed’) OR (TDisarmed;TFrontDoor<3:00))

In this case if the Garage Door is open, and has been before night … if you arm the Light will not come on.

OR:

CAutoOnGarage TNight AND TGarageDoor AND ((TArmMode eq ‘Armed’) OR ((TNight; TDisarmed) AND (TDisarmed;TGarageDoor<3:00)))
CAutoOnFront TNight AND TFrontDoor AND ((TArmMode eq ‘Armed’) OR ((TNight; TDisarmed) AND (TDisarmed;TFrontDoor<3:00)))

In this case if the Garage Door is open, and has been before night … if you arm the Light will come on.

I Assume you manually turn off the lights.