Author Topic: Auto lock door only after door is closed using PLEG  (Read 687 times)

Offline michaelhinchey

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Auto lock door only after door is closed using PLEG
« on: September 17, 2017, 10:51:02 pm »
Ok So I HAVE READ SOME STUFF ON THIS EXACT idea using PLEG.  Seems like it would be easy enough to understand, however I am confused when I get in PLEG in the vera website.  Could anyone walk me through how to set up what I want.  I think I could understand it better and start incorporating this into my Vera devices if I start from scratch..  First of all thank you for being patient.  Second, thank you for taking your valuable time to help a fellow Vera user out.  I am using vera plus and ui7.  I have a Kwikset door lock called front door lock and a Fibaro door sensor called front door sensor.  (fgdw-002).  I want to keep the door from locking when the sensor is in the open status. And also lock the door every 10 minutes or so.  I have scenes running the 10 minute check and locks the doAlthough it doesnt check when the door was last opened.  It would be great to start using PLEG to do this check.  Honestly I changed it to an hour because I was annoyed when my gf would go out and smoke it would lock her out and she would hit the buttons to open it.  This kills the battery on the lock.  Any help would be awesome. 

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9820
  • Karma: +742/-136
    • RTS Services Plugins
Re: Auto lock door only after door is closed using PLEG
« Reply #1 on: September 18, 2017, 02:50:34 pm »
Have you read the getting started guide?


Sent from my SAMSUNG-SM-G935A using Tapatalk


Offline gibby

  • Full Member
  • ***
  • Posts: 187
  • Karma: +3/-1
Re: Auto lock door only after door is closed using PLEG
« Reply #2 on: September 18, 2017, 05:12:42 pm »
Ok So I HAVE READ SOME STUFF ON THIS EXACT idea using PLEG.  Seems like it would be easy enough to understand, however I am confused when I get in PLEG in the vera website.  Could anyone walk me through how to set up what I want.  I think I could understand it better and start incorporating this into my Vera devices if I start from scratch..  First of all thank you for being patient.  Second, thank you for taking your valuable time to help a fellow Vera user out.  I am using vera plus and ui7.  I have a Kwikset door lock called front door lock and a Fibaro door sensor called front door sensor.  (fgdw-002).  I want to keep the door from locking when the sensor is in the open status. And also lock the door every 10 minutes or so.  I have scenes running the 10 minute check and locks the doAlthough it doesnt check when the door was last opened.  It would be great to start using PLEG to do this check.  Honestly I changed it to an hour because I was annoyed when my gf would go out and smoke it would lock her out and she would hit the buttons to open it.  This kills the battery on the lock.  Any help would be awesome.

It took me sometime to understand PLEG also, I never fully understood it on my old system with UI5, but it got hit by lightning and I got a new Plus with UI7 and had to do everything from scratch.

Under Logic Inputs -> Device Triggers

Create 2 device triggers

Trigger 1 (door lock)
Trigger Name - tFrontDoorUnlocked
Trigger Device - Select your front door lock
Event Type - A door is locked or unlocked
Which mode - Device is opened

Trigger 2 ( door open/close sensor)
Trigger Name - tFrontDoorClosed
Trigger Device - Select your front door open/close sensor
Event type - Whenever Device is closed whether is armed or disarmed

Under Conditions (Automatic Logic)

Create 1 new condition

Condition Name - cFrontDoorUnlockedClosed
Option - Repeats on
Syntax
Code: [Select]
tFrontDoorUnlocked and tFrontDoorClosed and ( tFrontDoorClosed;NOW > 00:03:00 ) and ( tFrontDoorUnlocked;NOW > 00:03:00 )Click save

This means whenever the door lock is unlocked for greater than 3 minutes and the door has been shut for greater than 3 minutes.


Under logic actions

Click dropdown for Select New Action and choose cFrontDoorUnlockedClosed
Click dropdown for Select Device to Add to the Current Interval and select your front door lock
Turn off advanced
Toggle the front door lock to the locked setting
Click Save

Now click on Editor Option in the top right and click on Reload LUA and then close.
Watch the top of the browser window for any PLEG errors while it reloads.
Test

Offline michaelhinchey

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: Auto lock door only after door is closed using PLEG
« Reply #3 on: September 18, 2017, 10:23:10 pm »
Have you read the getting started guide?


Sent from my SAMSUNG-SM-G935A using Tapatalk
Richard reading the 20 PLus pages now ;P

Offline michaelhinchey

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: Auto lock door only after door is closed using PLEG
« Reply #4 on: September 18, 2017, 10:30:05 pm »
Ok So I HAVE READ SOME STUFF ON THIS EXACT idea using PLEG.  Seems like it would be easy enough to understand, however I am confused when I get in PLEG in the vera website.  Could anyone walk me through how to set up what I want.  I think I could understand it better and start incorporating this into my Vera devices if I start from scratch..  First of all thank you for being patient.  Second, thank you for taking your valuable time to help a fellow Vera user out.  I am using vera plus and ui7.  I have a Kwikset door lock called front door lock and a Fibaro door sensor called front door sensor.  (fgdw-002).  I want to keep the door from locking when the sensor is in the open status. And also lock the door every 10 minutes or so.  I have scenes running the 10 minute check and locks the doAlthough it doesnt check when the door was last opened.  It would be great to start using PLEG to do this check.  Honestly I changed it to an hour because I was annoyed when my gf would go out and smoke it would lock her out and she would hit the buttons to open it.  This kills the battery on the lock.  Any help would be awesome.

It took me sometime to understand PLEG also, I never fully understood it on my old system with UI5, but it got hit by lightning and I got a new Plus with UI7 and had to do everything from scratch.

Under Logic Inputs -> Device Triggers

Create 2 device triggers

Trigger 1 (door lock)
Trigger Name - tFrontDoorUnlocked
Trigger Device - Select your front door lock
Event Type - A door is locked or unlocked
Which mode - Device is opened

Trigger 2 ( door open/close sensor)
Trigger Name - tFrontDoorClosed
Trigger Device - Select your front door open/close sensor
Event type - Whenever Device is closed whether is armed or disarmed

Under Conditions (Automatic Logic)

Create 1 new condition

Condition Name - cFrontDoorUnlockedClosed
Option - Repeats on
Syntax
Code: [Select]
tFrontDoorUnlocked and tFrontDoorClosed and ( tFrontDoorClosed;NOW > 00:03:00 ) and ( tFrontDoorUnlocked;NOW > 00:03:00 )Click save

This means whenever the door lock is unlocked for greater than 3 minutes and the door has been shut for greater than 3 minutes.


Under logic actions

Click dropdown for Select New Action and choose cFrontDoorUnlockedClosed
Click dropdown for Select Device to Add to the Current Interval and select your front door lock
Turn off advanced
Toggle the front door lock to the locked setting
Click Save

Now click on Editor Option in the top right and click on Reload LUA and then close.
Watch the top of the browser window for any PLEG errors while it reloads.
Test
OK thank you for this.  It was unclear if these were names needed in order for Pleg and vera to communicate ( tFrontDoorUnlocked , tFrontDoorClosed,cFrontDoorUnlockedClosed) but I see now they are names I am calling and can name these anything I want probably as long as the t(trigger) and c(condition) are in front of the name.  The t and c maybe just for ease of knowing which is which (Simplification) but I will continue to put them anyway just in case they are needed.
I will go over this and then implement it to test.  THANK YOU V much.  I will also finish reading the beginners guide to PLEG to get some more understanding. 

Offline zedrally

  • Hero Member
  • *****
  • Posts: 892
  • Karma: +3/-0
  • Black Cat Controllers & Control Systems
    • Black Cat Control Systems
Re: Auto lock door only after door is closed using PLEG
« Reply #5 on: September 18, 2017, 10:44:25 pm »

OK thank you for this.  It was unclear if these were names needed in order for Pleg and vera to communicate ( tFrontDoorUnlocked , tFrontDoorClosed,cFrontDoorUnlockedClosed) but I see now they are names I am calling and can name these anything I want probably as long as the t(trigger) and c(condition) are in front of the name.  The t and c maybe just for ease of knowing which is which (Simplification) but I will continue to put them anyway just in case they are needed.
I will go over this and then implement it to test.  THANK YOU V much.  I will also finish reading the beginners guide to PLEG to get some more understanding.


The t prefix is just that, a prefix to remind you that it is a Trigger, similarly c = Condition, p= Property and so on. There is no need for them apart from the ease of remembering what they are.
Living in the Land of Oz, give me a vegemite sandwich. Home Seer, Vera Lite & Edge, Popp, Black Cat Smart Hub & Vera G, Black Cat Lite 1 & 2's a Black Cat Dimmer or 2, then some  Black Cat Cat's Eye PIR's & Door-Window Sensors, Broadlink RMPro & Mini plus a Z-UNO or 2.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 942
  • Karma: +20/-18
    • Worthington Engineering, Inc.
Re: Auto lock door only after door is closed using PLEG
« Reply #6 on: September 19, 2017, 07:33:45 pm »
...and in case you have a property, trigger, and/or condition with the same name.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline michaelhinchey

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: Auto lock door only after door is closed using PLEG
« Reply #7 on: September 23, 2017, 12:58:51 pm »

OK thank you for this.  It was unclear if these were names needed in order for Pleg and vera to communicate ( tFrontDoorUnlocked , tFrontDoorClosed,cFrontDoorUnlockedClosed) but I see now they are names I am calling and can name these anything I want probably as long as the t(trigger) and c(condition) are in front of the name.  The t and c maybe just for ease of knowing which is which (Simplification) but I will continue to put them anyway just in case they are needed.
I will go over this and then implement it to test.  THANK YOU V much.  I will also finish reading the beginners guide to PLEG to get some more understanding.
THANKS for the info.   I will start reading after the weekend.  Im so very interested in this.  I hear there is an app being redone for android that incorporates pleg into it.  Iphone already has this in place.  Any one with an iphone care to comment how this makes it easier?

The t prefix is just that, a prefix to remind you that it is a Trigger, similarly c = Condition, p= Property and so on. There is no need for them apart from the ease of remembering what they are.

Offline michaelhinchey

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: Auto lock door only after door is closed using PLEG
« Reply #8 on: September 23, 2017, 03:05:48 pm »
Ok So I HAVE READ SOME STUFF ON THIS EXACT idea using PLEG.  Seems like it would be easy enough to understand, however I am confused when I get in PLEG in the vera website.  Could anyone walk me through how to set up what I want.  I think I could understand it better and start incorporating this into my Vera devices if I start from scratch..  First of all thank you for being patient.  Second, thank you for taking your valuable time to help a fellow Vera user out.  I am using vera plus and ui7.  I have a Kwikset door lock called front door lock and a Fibaro door sensor called front door sensor.  (fgdw-002).  I want to keep the door from locking when the sensor is in the open status. And also lock the door every 10 minutes or so.  I have scenes running the 10 minute check and locks the doAlthough it doesnt check when the door was last opened.  It would be great to start using PLEG to do this check.  Honestly I changed it to an hour because I was annoyed when my gf would go out and smoke it would lock her out and she would hit the buttons to open it.  This kills the battery on the lock.  Any help would be awesome.
I dont get any errors while reloading the engine however when I rm the PLeg device it reads this error Trigger Description error: TypeError: Cannot read property 'value' of undefined
Any ideas?

It took me sometime to understand PLEG also, I never fully understood it on my old system with UI5, but it got hit by lightning and I got a new Plus with UI7 and had to do everything from scratch.

Under Logic Inputs -> Device Triggers

Create 2 device triggers

Trigger 1 (door lock)
Trigger Name - tFrontDoorUnlocked
Trigger Device - Select your front door lock
Event Type - A door is locked or unlocked
Which mode - Device is opened

Trigger 2 ( door open/close sensor)
Trigger Name - tFrontDoorClosed
Trigger Device - Select your front door open/close sensor
Event type - Whenever Device is closed whether is armed or disarmed

Under Conditions (Automatic Logic)

Create 1 new condition

Condition Name - cFrontDoorUnlockedClosed
Option - Repeats on
Syntax
Code: [Select]
tFrontDoorUnlocked and tFrontDoorClosed and ( tFrontDoorClosed;NOW > 00:03:00 ) and ( tFrontDoorUnlocked;NOW > 00:03:00 )Click save

This means whenever the door lock is unlocked for greater than 3 minutes and the door has been shut for greater than 3 minutes.


Under logic actions

Click dropdown for Select New Action and choose cFrontDoorUnlockedClosed
Click dropdown for Select Device to Add to the Current Interval and select your front door lock
Turn off advanced
Toggle the front door lock to the locked setting
Click Save

Now click on Editor Option in the top right and click on Reload LUA and then close.
Watch the top of the browser window for any PLEG errors while it reloads.
Test

Offline michaelhinchey

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: Auto lock door only after door is closed using PLEG
« Reply #9 on: September 24, 2017, 07:30:43 pm »
I dont get any errors while reloading the engine however when I rm the PLeg device it reads this error Trigger Description error: TypeError: Cannot read property 'value' of undefined
Any ideas?

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 942
  • Karma: +20/-18
    • Worthington Engineering, Inc.
Re: Auto lock door only after door is closed using PLEG
« Reply #10 on: September 24, 2017, 08:18:03 pm »
Sounds like it was expecting a number or character and it found a character or number.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline gibby

  • Full Member
  • ***
  • Posts: 187
  • Karma: +3/-1
Re: Auto lock door only after door is closed using PLEG
« Reply #11 on: September 25, 2017, 09:12:41 am »
I dont get any errors while reloading the engine however when I rm the PLeg device it reads this error Trigger Description error: TypeError: Cannot read property 'value' of undefined
Any ideas?

You will have to show us what you have in PLEG so we can help.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 942
  • Karma: +20/-18
    • Worthington Engineering, Inc.
Re: Auto lock door only after door is closed using PLEG
« Reply #12 on: September 25, 2017, 08:23:35 pm »
I dont get any errors while reloading the engine however when I rm the PLeg device it reads this error Trigger Description error: TypeError: Cannot read property 'value' of undefined
Any ideas?

You will have to show us what you have in PLEG so we can help.

Usually this is done by posting a Status Report PDF. Sample attached.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline michaelhinchey

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: Auto lock door only after door is closed using PLEG
« Reply #13 on: September 26, 2017, 06:42:21 pm »
I dont get any errors while reloading the engine however when I rm the PLeg device it reads this error Trigger Description error: TypeError: Cannot read property 'value' of undefined
Any ideas?

You will have to show us what you have in PLEG so we can help.

Usually this is done by posting a Status Report PDF. Sample attached.
[/quote
Wow that pdf is intimidating.Lots of expert Pleg Coding there/   IM unsure how to get a pdf file.  I tried exporting a file but it doesnt allow me to see it.  Any help?

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 942
  • Karma: +20/-18
    • Worthington Engineering, Inc.
Re: Auto lock door only after door is closed using PLEG
« Reply #14 on: September 26, 2017, 09:24:14 pm »
Lots of trial and error - especially the error.

Once your status report window pops up, I use a free PDF printer.  Here is a screenshot.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.