Page 1 of 1
Schedule in LUA (or shell/python)?
Posted: Tuesday 21 June 2016 0:38
by JustME125
I have been playing around with domoticz for a while now and have a lot of lights, switches, heating and ventilation running through domoticz (my girlfriend actually likes it

) but I am wondering how it is possible to create schedule functionality that is available in lua (for example). I know I can make a dummy switch and attach a schedule to it through the timer functionality but I am looking for a more elegant solution.
I could off course hardcode the scheduling in lua but that prevents me from easily editing the schedule by phone for example and drastically reduces the WAF.
I am looking for a way to create more elaborate scheduling which allows for a broader use instead of only being able to schedule 1 device through 1 timer.
Anyone any idea how to create such schedule that is not linked to 1 particular device and is easily editable (WAF), available in lua and elegant in use (not additional dummy switches)?
Verstuurd vanaf mijn HTC One_M8 met Tapatalk
Re: Schedule in LUA (or shell/python)?
Posted: Tuesday 21 June 2016 7:30
by gizmocuz
If you want to control multiple lights at once, place them in a 'group' and add a timer on this group.
it is probably the same you do with lua/blockly/python right ?
And besides the 'dummy switch and elegant stuff', how often are you going to create new timers ?
Re: Schedule in LUA (or shell/python)?
Posted: Tuesday 05 July 2016 8:59
by annieoroberts00
very useful thread.
Re: Schedule in LUA (or shell/python)?
Posted: Tuesday 05 July 2016 13:14
by JustME125
Unfortunately no replies so for.
Re: Schedule in LUA (or shell/python)?
Posted: Tuesday 05 July 2016 18:50
by jannl
I think the reply of gizmocuz is not bad. Besides, I basically never change my schedules. Running mostly for 2 years almost. Only added hardware needs updates to a schedule.
Re: Schedule in LUA (or shell/python)?
Posted: Wednesday 06 July 2016 13:19
by paulD
Hi,
You may define your schedule in googlecalendar. Search the forum and wiki to interact with google calendar in your lua script.
Re: Schedule in LUA (or shell/python)?
Posted: Wednesday 06 July 2016 22:31
by JustME125
Thanks for that angle Paul, never thought of that. One example of what I would like to accomplish is heating. Normally you tend to time the moment that your heating has to switch on or off, but I have pretty much defined how fast I can heat the house based on environment temperature etc so I don't need to know when I need to switch on (which can be achieved perfectly with the build in timers) but when a temperature should be reached. So instead of reacting on a schedule I want to anticipate when to switch on to achieve the desired state described in the schedule, the moment to switch depends on variables.
I hope this kind of clarifies why I asked my question.
Verstuurd vanaf mijn HTC One_M8 met Tapatalk
Re: Schedule in LUA (or shell/python)?
Posted: Wednesday 06 July 2016 23:12
by georgesattali
Hello,
Your question is quite straightforward and easy to understand, but a bit difficult to implement, as it's a prediction in the future.
it seems that curl '
http://127.0.0.1:8080/json.htm?type=sch ... ter=device' returns the list of timers planned for the next 24 hours ("ScheduleDate"). You may decode this result using JSON.lua (google).
So, you could create a Schedule for the moment you aim being warm plus a "time" script (called every minutes), that computes the time needed to heat and starts heating if
Code: Select all
now < ScheduleDate <= now+"time needed"
and "not already started".
if you know that time needed is less than 2 hours, then you dont need to compute if now+"2 hours" < ScheduleDate.
Hope this helps, see you,
GD
Re: Schedule in LUA (or shell/python)?
Posted: Wednesday 06 July 2016 23:43
by JustME125
Hi GD,
That sounds damn good and pretty easy. I am absolutely no coder but I think I can figure out how to do it. My main concerns is getting the timer stuff in lua, not find some time to start working on this solution.
Thanks so far!
Verstuurd vanaf mijn HTC One_M8 met Tapatalk
Re: Schedule in LUA (or shell/python)?
Posted: Friday 22 July 2016 0:52
by JustME125
georgesattali wrote:Hello,
it seems that curl '
http://127.0.0.1:8080/json.htm?type=sch ... ter=device' returns the list of timers planned for the next 24 hours ("ScheduleDate"). You may decode this result using JSON.lua (google).
Code: Select all
now < ScheduleDate <= now+"time needed"
and "not already started".
Hope this helps, see you,
GD
I found out that:
curl '
http://127.0.0.1:8080/json.htm?type=sch ... thermostat' returns only thermostat type schedules. One step further, I have my holidays in a few weeks so I hope to finish this by the end of my holidays.
BR