24.07.2017, 07:10
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
Scheduled script
|
24.07.2017, 07:10
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
24.07.2017, 07:16
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')
26.07.2017, 11:59
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.
26.07.2017, 18:09
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.
27.07.2017, 10:57
I know this, but I need to run a scheduled script with all the conditions (hour, day, month) after the rain,
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.
28.07.2017, 09:12
to MLAUDREN, thanks for your help and inspiration...
31.07.2017, 14:43
(This post was last modified: 31.07.2017, 14:46 by Erwin van der Zwart.)
Line 13 of script 2 must be script.enable ..
31.07.2017, 15:34
Correct Erwin! wrong copy/past...
I've updated the script. |
« Next Oldest | Next Newest »
|