Understanding timed scripting - 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: Understanding timed scripting (/showthread.php?tid=250) |
Understanding timed scripting - FatMax - 19.03.2016 I´m having some problems understanding why my tried timers don´t work as I want them to. I have these two scripts, in two scheduled scripts: Code: -- Trigger The first one is to trigger 100% lighting for one hour, for cleaning purposes. It also locks the PIRs, saves the lighting state before setting 100% and sets a status object so we know it is in play. However, when I activate the script, everything just goes to 100% immediately. If i try to put it in a normal event script, nothing happens when I push the button.... Code: -- group address or name This last one is for slowly dimming down the lights in a kids room. However, when I activate this script, whenever the lights is turned on normal, it will always dim down and go dark after a while.... What am I missing here..? RE: Understanding timed scripting - admin - 21.03.2016 First script should be split into one event and one scheduled. Event should handle levels and PIR lock depending on received value (true/false). Scheduled script should just send false if event script control object has been on for 1 hour. You can use these examples for auto-off functionality: http://forum.logicmachine.net/showthread.php?tid=43 Second script will always work when 3/5/8 is on. Shouldn't the script write false to 3/5/8 in the end? Also, your if sequence is somewhat incorrect, as with delta increasing more ifs will be triggered and unwanted telegrams will be sent. You need to reverse it and use elseif: Code: -- group address or name |