Page 1 of 1

More flexible recurring timers

Posted: Thursday 10 December 2015 13:40
by Bikey
I would like the setting of the timers to be more flexible. Not only to repeat an event every day or week, but also
  • every "x" days, weeks, or months. E.g. every 3 days, or every 2 weeks.
  • every "N'th" day of every "x'th" month. E.g. the first day of every 2 months.
I curently have a timer that needs to change every other week, but now have to change it every week (and not forget).

Re: More flexible recurring timers

Posted: Thursday 10 December 2015 14:48
by Egregius
Is the timer recurring every 2 weeks?
Like week 1 = schedule A
week 2 = schedule B
week 3 = schedule A
week 4 = schedule B

Re: More flexible recurring timers

Posted: Thursday 10 December 2015 20:22
by alfred_j_kwak

Re: More flexible recurring timers

Posted: Friday 11 December 2015 7:32
by jannl
Or crontab? What are you using now?

Re: More flexible recurring timers

Posted: Friday 11 December 2015 15:36
by Bikey
Egregius wrote:Is the timer recurring every 2 weeks?
Like week 1 = schedule A
week 2 = schedule B
week 3 = schedule A
week 4 = schedule B
Yes that is what I currently need.
Or crontab? What are you using now?
I'n now using the regular timers as can be set for a device or group. But now I have to adjust these manually each week (or x days), as my schedule changes.
Of course I could use crontab, but for every change I would have to SSH to the command line. That is not really user friendly.
Can you use Google calendar?
Yes, I looked at that, but seems to be quite complicated for such a simple requirement.
Besides that, I don't like my timers to be dependent on my internet connection.

Re: More flexible recurring timers

Posted: Friday 11 December 2015 15:56
by jannl
So you could use a script that updates the setting as you want?
May be not lua but perl/python/php or so, in combination with crontab.

Re: More flexible recurring timers

Posted: Friday 11 December 2015 16:03
by alfred_j_kwak
You could also use Dummy switches.
If you use Lua you can also use User Variables. Here: https://www.domoticz.com/wiki/User_variables is the base of script that you could expand to take care of odd and even weeks and days etc. Then you can use those values to set Dummy switches and then use those Dummys to control actual switches.

Like so: http://lua-users.org/wiki/WeekNumberInYear

Or little bit simpler: Current_week = os.date("%V")

Re: More flexible recurring timers

Posted: Friday 11 December 2015 17:21
by Bikey
Thanks for al your suggestions! Sure with programming you could make this work.
The point/question I wanted to make however is to suggest that this functionality would be added to the standard timer-settings in Domoticz. It seems to be a small change to the current functionality yielding much flexibility.
That's why I posted this in this "Suggestions" topic and not the "Problems" forum :roll:

Re: More flexible recurring timers

Posted: Friday 11 December 2015 19:41
by Egregius
Have a look in my cron.php file on github at https://github.com/Egregius/PHP-Custom- ... e/cron.php
The part of 'slaapkamer Tobi' does exactly what you want by looking at odd/even weeknumber.

Re: More flexible recurring timers

Posted: Wednesday 16 December 2015 10:26
by Bikey
Why does it has to be so difficult? IMHO setting timers is one of the most basic functions you would expect from HomeAutomation software.

Sure you can program everything in Lua of PHP or integrate with other systems, but to me if you have to do that for this kind of "basic" functionality, that defies the added value of having an easy to set-up but even more to maintain home automation system. And I'm not even talking about the WAF ;)

We are just talking about adding the following options (see arrow), in the week and monthly setting to get it just as flexible as e.g. Google Calendar:
Calendar-repeat.png
Calendar-repeat.png (35.81 KiB) Viewed 1763 times
Also the option to set the event to End after x occurrences or at a day is really something that is missing in the current implementation of Domoticz. How great would it even be if this could be implemented for the timer-plan settings (in the general settings menu) scheduling as well!

And adding the option to schedule items on the "x th" day of the month, or every "first sunday" of the month:
Calendar-repeat-month.png
Calendar-repeat-month.png (37.47 KiB) Viewed 1763 times

Re: More flexible recurring timers

Posted: Wednesday 16 December 2015 10:33
by Egregius
Google Calendar isn't that hard to integrate.
In 5 minutes I had my appointments printed on the terminal. 90 Minutes later it was fully integrated in my php scripting.
Most of the 90 minutes was because I need to change from xcache to memcached to store variables, xcache isn't available in php CLI mode used by the GCal script.