Scheduled script - 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: Scheduled script (/showthread.php?tid=914) |
Scheduled script - kostal.borek - 24.07.2017 Hi, I need the script triggered by one event first to check whether it is 8am to 8pm, whether it is Monday to Friday and eventually April to October. Can you please advise me? Thanks RE: Scheduled script - admin - 24.07.2017 Can you describe the task that you have? You can get current date/time as a Lua table like this and write your checks accordingly: Code: dt = os.date('*t') RE: Scheduled script - kostal.borek - 26.07.2017 Hi admin, thanks for your reply. My task is to run blinds from Monday to Friday and from May to October. The blinds are to run at 8am and pull out at 8pm. At the same time, I need the script to respond to changes in the wind sensor and rain sensor addresses. This means that during the day it will rain the blinds pulls the control script on the rain, but after the end of the rain, the script will again respond. RE: Scheduled script - mlaudren - 26.07.2017 You can use the scheduler for the first part: open from 8am to 8pm, May->October For the other, you can do a script base on the rain/wind event, probably using a tag, that will give/remove control of the blind. RE: Scheduled script - kostal.borek - 27.07.2017 I know this, but I need to run a scheduled script with all the conditions (hour, day, month) after the rain, RE: Scheduled script - mlaudren - 27.07.2017 no need. you have the scheduler link to an object: objA then you have a script which control the curtain: sc1 link to objA And a second one for the weather computation : sc2 attach to a tag: weatherSensor Your rain sensor object, wind, ... any weather related object is tagged as weatherSensor So, you'll have something like this: sc1 will be called with the scheduler. If it's raining, sc2 will be called and will disable sc1. once the rain is gone, sc2 will be called again to reactivate sc1 and run it. In sc1, you just need to verify if blind should be open or close regarding the value of objA. it will give code something like this: script1 Code: cmdblinds = grp.getvalue('objA') Code: rain = grp.getvalue('rainStatus') I'm sure it can be optimized, but this will do the trick. RE: Scheduled script - kostal.borek - 28.07.2017 to MLAUDREN, thanks for your help and inspiration... RE: Scheduled script - Erwin van der Zwart - 31.07.2017 Line 13 of script 2 must be script.enable .. RE: Scheduled script - mlaudren - 31.07.2017 Correct Erwin! wrong copy/past... I've updated the script. |