Author Topic: Existing PLEG script  (Read 737 times)

Offline REKEMP10

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Existing PLEG script
« on: April 29, 2017, 10:53:52 am »
Pretty much a novice on scripting on Vera but have been able to fumble my way thru one using the PLEG app.  It monitors a change of status from one device - runs some LUA code - than turns on a light.  Pretty simple.  But I want the behavior to be that if it daytime do not turn on the light - but still run the LUA code.   I'm assuming that he LUA code runs prior to turning on the light - so I was wondering is there a way to test for daytime in the LUA code - if it TRUE - than exit out completly so the "turn on light " part is not executed.  I have this working now in the PLEG app but it starts out with 2 triggers - if status change AND daylight run LUA code - and it ends there - or another trigger that has status change AND nightime - and run LUA code plus the additional step to  turn on light.  I know there is a better way than doing it...

Offline MNB

  • Hero Member
  • *****
  • Posts: 689
  • Karma: +4/-9
Re: Existing PLEG script
« Reply #1 on: April 29, 2017, 11:23:04 am »
@REKEMP10, would suggest that you peruse the Program Logic Plugin section in the forum, I believe there are a number of examples that might help you with your PLEG enlightenment  ;D
Edge-1.7.2607, VRI06-1LX Dimr (6), VS05-1LX Sw (4), GE ZW3002 Dimr (1), HA01C Outlet (12), HA02C Sw (6), HA04C Sw (4), GE Sw (2), HA05 Sw (3), MiniMote Contr (5), HSM200/100 Sensor (2), ZW100A Sensor (8), Nest thermostat (1) & Protect Fire/CO (6) Kwikset Locks (3), F18918W (1) & IP3M-9 (6) Cam's

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1259
  • Karma: +31/-32
Re: Existing PLEG script
« Reply #2 on: April 29, 2017, 02:17:06 pm »
Have you thought of 2 action - 1 to execute the LUA, and 1 to turn on the light? You can use virtual or combination switches to offer the control you are looking for.
Vera 3, 1.7.1030, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb