The Vera Community forums have moved!

Advanced => Programming => Scene Scripting => Topic started by: Javierrg on April 06, 2014, 07:24:19 am

Title: Window sensor trigger
Post by: Javierrg on April 06, 2014, 07:24:19 am
Hi, how can i do this?..... If my window sensor is open for more then X time turn the AC off.
Title: Re: Window sensor trigger
Post by: RexBeckett on April 06, 2014, 07:43:47 am
It would be easy to do this with Program Logic Event Generator (PLEG) plugin. See PLEG Basics (http://forum.micasaverde.com/index.php/topic,21603.0.html) for an introduction.

You could also do it using Lua code in a scene with a delayed action. See Conditional Scene Execution (http://forum.micasaverde.com/index.php/topic,18679.0.html).
Title: Re: Window sensor trigger
Post by: Javierrg on April 07, 2014, 07:47:54 pm
Cant get it to work :(... new to pleg sry
Title: Re: Window sensor trigger
Post by: RexBeckett on April 07, 2014, 08:15:42 pm
Cant get it to work :(... new to pleg sry
A little more explanation of your problem would be helpful...

You would want something along these lines:

Triggers
WindowOpen     Window sensor tripped

Conditions
TurnOffAC           WindowOpen and (WindowOpen; Now > 5:00)

Actions
TurnOffAC           AirCon turn off
Title: Re: Window sensor trigger
Post by: Javierrg on April 07, 2014, 08:50:35 pm
its not working with the timer, i set it to now > 10 ) it took like a minute to trigger
Title: Re: Window sensor trigger
Post by: SirMeili on April 07, 2014, 10:52:53 pm
NOW only updates every minute. You put 10 seconds as your difference so that condition will evaluate as true somewhere between 10 seconds and about 1 minute and 9 seconds (roughly) after the window is opened.

Sent from my Nexus 7 using Tapatalk
Title: Re: Window sensor trigger
Post by: RichardTSchaefer on April 08, 2014, 01:59:16 pm
If you want a smaller interval or more precise time than using NOW, which has one minute resolution, than do the following:

Create an input timer call XYZZY, pick your own name.
Thus will be a self trigger timer.The off time will be interval with the desired interval. This will give you an accurate time in your logic.

however you need two conditions:

WindowOpen
Timeout            WindowOpen and (XYZZY; !XYZZY)

The action for WindowOpen will start the timer.