On time delay - 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: On time delay (/showthread.php?tid=1027) |
On time delay - Frankg - 05.10.2017 Hi. i don't figure out the soulution for a on delay script. so i would appreciate some guidance here task: if value is higher than 10 for a constant 1800 sekonds then it send true signal. if 10 > (spjeldvinkel_setpoint * spjeldvinkel_feedback / 100) then grp.write('14/2/1', true) else grp.write('14/2/1', false) - Frank RE: On time delay - admin - 05.10.2017 First, create an event script attached to your setpoint and feedback objects (replace 1/1/1 and 1/1/2 with your group addresses): Code: setpoint = grp.getvalue('1/1/1') Then, create a resident script with 30 or 60 second sleep time (or you can use a scheduled script that runs every minute): Code: delta = os.time() - storage.get('timer', 0) RE: On time delay - Frankg - 05.10.2017 Thanks! After some hours i beginning to understand the programming in lua and now i have been trying to solve next case on this script that accured. when i get e new value on feedback or setpoint input, the script sends out a "false" and start counting all over. How do i get it to hold the value (True orfalse) and only send by change of the output? And when in false state it sends out evry second since it dosen't send by change RE: On time delay - admin - 06.10.2017 Can you explain the whole algorithm of your task then? RE: On time delay - Frankg - 06.10.2017 1 reed feedback % 2 reed setpoint % 3 calculate to se if its over or under 10 % diffrence 4 if <= 10 % send false 5 If >= 10 % more than 30 minuts send true and only send by change so it dont't jam the knx bus RE: On time delay - admin - 06.10.2017 That's what the script is already doing, except that it expects at least one telegram from setpoint or feedback object in 30 minutes. You can set poll interval for one of these objects to ensure that timer is updated via event script. grp.checkwrite ensures that only new value is sent to the bus. Or you can use a single resident script (set sleep interval to at least 5 seconds or more) without event scripts. This way some status feedback can be missed, but I don't think that it will make much difference. Code: setpoint = grp.getvalue('1/1/1') |