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

Easy to use, 100% Lua-based event scripting framework.
Post Reply
User avatar
waaren
Posts: 505
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Timer events start on the hour, every hour

Post by waaren » Tuesday 10 January 2017 15:43

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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave , dzVents 2.4.n, Amazon echo

User avatar
waaren
Posts: 505
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Timer events start on the hour, every hour

Post by waaren » Wednesday 11 January 2017 0:45

That is a very good summary indeed.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave , dzVents 2.4.n, Amazon echo

dannybloe
Posts: 1408
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

Re: Timer events start on the hour, every hour

Post by dannybloe » Wednesday 11 January 2017 10:35

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..
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

dannybloe
Posts: 1408
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

Re: Timer events start on the hour, every hour

Post by dannybloe » Wednesday 11 January 2017 12:13

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.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

User avatar
waaren
Posts: 505
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Timer events start on the hour, every hour

Post by waaren » Thursday 12 January 2017 1:02

Thx gordonb3 and dannybloe for looking into this. Much apreciated
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave , dzVents 2.4.n, Amazon echo

dannybloe
Posts: 1408
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

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

Post by dannybloe » Thursday 12 January 2017 16:11

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.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

User avatar
waaren
Posts: 505
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Timer events start on the hour, every hour

Post by waaren » Friday 13 January 2017 16:29

@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.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave , dzVents 2.4.n, Amazon echo

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest