Page 1 of 1

Timer events start on the hour, every hour

Posted: Tuesday 10 January 2017 14:43
by waaren
I use dzVents on my Synology 916+ (DSM6.1) with Domoticz version 3.6312 for a number of scripts. It's working great and simplifies the coding efforts a lot.
Looking at Domoticz logfile, I noticed that all my time based dzVents scripts are executed on the hour every hour, including the scripts with a timer setting in minutes that should not run on the hour (or I at least I did not expect it to do so)
Is this as designed or do I overlook something ?

Dishwasher.lua: ['timer'] = 'every 16 minutes'
Washer.lua: ['timer'] = 'every 17 minutes'
Blinds.lua: ['timer'] = 'every 29 minutes'

2017-01-10 12:00:00.546 LUA: >>> Handler: Dishwasher
2017-01-10 12:00:00.546 LUA: >>> Handler: Washer
2017-01-10 12:00:00.547 LUA: >>> Handler: Blinds
2017-01-10 13:00:00.153 LUA: >>> Handler: Dishwasher
2017-01-10 13:00:00.154 LUA: >>> Handler: Washer
2017-01-10 13:00:00.155 LUA: >>> Handler: Blinds

and

2017-01-10 13:00:00.153 LUA: >>> Handler: Dishwasher
2017-01-10 13:16:00.205 LUA: >>> Handler: Dishwasher
2017-01-10 13:32:00.149 LUA: >>> Handler: Dishwasher
2017-01-10 13:48:00.401 LUA: >>> Handler: Dishwasher
2017-01-10 14:00:00.089 LUA: >>> Handler: Dishwasher
2017-01-10 14:16:00.443 LUA: >>> Handler: Dishwasher

Re: Timer events start on the hour, every hour

Posted: Tuesday 10 January 2017 23:45
by waaren
That is a very good summary indeed.

Re: Timer events start on the hour, every hour

Posted: Wednesday 11 January 2017 9:35
by dannybloe
Indeed it was :mrgreen: Looking at the code:

Code: Select all

	function self.isTriggerByMinute(m, testTime)
		local time = self.getNow(testTime)
		return (time.min / m == math.floor(time.min / m))
	end
It sees if time.min can be devided by the interval (m). Of course that is bs :lol:

Ehm... now finding a solution that doesn't require state is kinda hard. So... if you have any ideas..

Re: Timer events start on the hour, every hour

Posted: Wednesday 11 January 2017 11:13
by dannybloe
I could use the script storage solution that is being used by the persisted variables. Anyhow... in the coming days/weeks I don't think I have time to fix this (some house reconstruction work that needs to be finished first). But I will make a github ticket for this.

In the meantime I'd stick to intervals that do work given the current algorithm.

Re: Timer events start on the hour, every hour

Posted: Thursday 12 January 2017 0:02
by waaren
Thx gordonb3 and dannybloe for looking into this. Much apreciated

Re: Timer events start on the hour, every hour  [Solved]

Posted: Thursday 12 January 2017 15:11
by dannybloe
dannybloe wrote:I could use the script storage solution that is being used by the persisted variables. Anyhow... in the coming days/weeks I don't think I have time to fix this (some house reconstruction work that needs to be finished first). But I will make a github ticket for this.

In the meantime I'd stick to intervals that do work given the current algorithm.
Or you create a s.tload of ['timer'] = 'at xx:xx' entries around the clock of course. Then it will only skip a beat at 00:00 probably.

Re: Timer events start on the hour, every hour

Posted: Friday 13 January 2017 15:29
by waaren
@dannybloe Thanks. As a workaround I created some ['timer'] = 'at xx:xx' entries which, as a side effect, effectively lowered the number of calls to the scripts as I could narrow them to the hours I actually need.