Staircase timer - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Staircase timer (/showthread.php?tid=924) |
Staircase timer - Kuronen - 03.08.2017 Being new to LUA I´m finding it difficult to get everything right. Could some one help me with below.?? Please I have tried to create a simple Staircase timer for lighting control with the following functions: 1bit KNX command = true activates (From presence detector) (1.) Sends a KNX Byte value "90%" (2.) After not receiving (1bit from presence detector) in 30 min send KNX byte value 20% (3.) After not receiving (1bit from presence detector) in 60 min send KNX byte value 0% (( If triggered by 1bit from presence detector it should re-trigger the staircase timer.)) I need to run multiple staircase timers for different areas with the same LM unit.! RE: Staircase timer - AEK - 03.08.2017 (03.08.2017, 08:05)Kuronen Wrote: Being new to LUA I´m finding it difficult to get everything right. Could some one help me with below.?? PleaseHi! here is example. but its not good to use so big os.sleep timer in event based script just add event based script for your presense sensor group address Code: scale_adress= '1/1/4' RE: Staircase timer - Kuronen - 03.08.2017 Thanks for the quick response, I got this to almost work. Issues i have are thus: If "" scale_adress= 'x/x/x' "" has no previous value the script will not write "100" until a value is written once. (problem if power goes out) "" Also for every PIR-trigger that is sent a new event based script is started which puts everything out of sync. Should it be a resident script instead? RE: Staircase timer - Erwin van der Zwart - 03.08.2017 Hi, Check this article: https://forum.logicmachine.net/showthread.php?tid=737&pid=4175#pid4175 BR, Erwin RE: Staircase timer - Kuronen - 03.08.2017 Thanks Erwin, I found that and started from there. But with my limited experience of LUA, and no need or possibility to write values since these are fixed it seemed to komplex for me att this point of time. But if that is the only way then i have to go down that road ;-) . The function i wanted to achieve is usually only a couple of mouse-clicks away with KNX-devices, and i have no spent hours in trying to get this to work. :-( . RE: Staircase timer - Kuronen - 03.08.2017 Ok Guys, I copied it straight off and put it in an event based script. But i do not get it to work. Could some one help me with a step by step explanation on how to proceed to get this script to work? Erwin?? The shorter basic scripts I made work. RE: Staircase timer - Erwin van der Zwart - 03.08.2017 Hi, Did you put it as event linked to the same address as the input address you have set in the start of the script? I pointed out this script as it holds the function to kill a previous running script by store the program id and kill previous pid on next execution. BR, Erwin RE: Staircase timer - Kuronen - 03.08.2017 Yes Event 6/0/0 also tired other adresses -- Set input address AddressInput = '6/0/0' /J RE: Staircase timer - admin - 04.08.2017 Create an event script for each PIR. It will only react when PIR sends true. In this case it will store current time in storage under unique key and will set output value to 90% if it's not already 90%. This is done by using checkwrite which does not pollute the bus with telegrams with duplicate values. Adjust output group address for each PIR script as needed. Code: if event.getvalue() then Create a resident script which will monitor PIR timers and will set output values as needed. Tune sleep interval as needed, don't use 0, otherwise it will consume all system resources. If you really need to wait 30/60 minutes after last movement detection then you can use maximum sleep time of 60 seconds. You can add as many elements to pirs table as needed, input is PIR group address, output is your dimmer. You need to disable/enable the script if you change pirs table. Code: if not pirs then |