More flexible recurring timers

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

More flexible recurring timers

Post 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).
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: More flexible recurring timers

Post 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
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: More flexible recurring timers

Post by alfred_j_kwak »

jannl
Posts: 823
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.5.x
Location: Geleen
Contact:

Re: More flexible recurring timers

Post by jannl »

Or crontab? What are you using now?
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: More flexible recurring timers

Post 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.
jannl
Posts: 823
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.5.x
Location: Geleen
Contact:

Re: More flexible recurring timers

Post 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.
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: More flexible recurring timers

Post 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")
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: More flexible recurring timers

Post 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:
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: More flexible recurring timers

Post 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.
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: More flexible recurring timers

Post 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 1742 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 1742 times
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: More flexible recurring timers

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest