2 hour 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: 2 hour timer (/showthread.php?tid=3153) |
2 hour timer - benanderson_475 - 09.02.2021 I need to switch the exterior lights off for the building 2 hours after store closes which is set by preset schedule time and switches group 2/2/2, Currently i have an event script on 2/2/2(trigger from schedule) storing the os.time() at the scheduled time, then a resident script set to 60s checking the difference between the stored value and the current to see if time has expired like Code: schedule_off = grp.getvalue('2/2/2') is there a way to receive the scheduled off time for the schedule (from the schedular) and add 2 hours to this then execute the off command after the 2 hour period? like having an offset value for a specific timed schedule, the same as in sunrise/sunset + or - 1 hour etc? is there a better way to do it and what is best? RE: 2 hour timer - admin - 09.02.2021 Scheduled script that runs once a minute should be enough for this task. If you want to find a certain event time, you can only do this via database query. Change scheduler ID as needed. This example assumes that scheduler has only one event with 0/false value. Code: scheduler = 1 -- scheduler ID |