dzvents timer problem  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
pgas37
Posts: 115
Joined: Wednesday 06 December 2017 19:44
Target OS: -
Domoticz version:
Contact:

dzvents timer problem

Post by pgas37 »

Rapsberry pi V3
Domoticz version 3.8153
Dzvents version 2.20

I need a timer that:
- starts 60 minutes after sunrise
- is activted inly during daytime
- every 5 minutes

I tried : timer = {' 60 minutes after sunrise at daytime every 5 minutes'}, but that doesn't work

I tried to solve the problem by retrieving the minutes after sunrise with: MinAfterSunrise = timeofday['SunriseInMinutes'] and put the output in an if/then statement, but "MinAfterSunrise " always returns with the same number.

Can anyone help me with this one?

thanks a lot

regards
Paul
landaisbenj
Posts: 147
Joined: Wednesday 02 August 2017 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: France
Contact:

Re: dzvents timer problem

Post by landaisbenj »

If you do this 60 after sunrise it's not daytim...

Try to create a planified dummy.

And do a script who start like this:

If otherdevice['ThisDummy']=='On' and (os.date('%M') % 5)==0 then
Platforme: Rpbi3b
Domoticz: Last stable
Bridge: RFLINK last stable
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzvents timer problem

Post by waaren »

landaisbenj wrote: Monday 19 March 2018 12:28 If you do this 60 after sunrise it's not daytim...

Try to create a planified dummy.

And do a script who start like this:

If otherdevice['ThisDummy']=='On' and (os.date('%M') % 5)==0 then
This code will not work in dzVents 2.4 (not sure it will in 2.2)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzvents timer problem

Post by waaren »

pgas37 wrote: Monday 19 March 2018 11:56 I need a timer that:
- starts 60 minutes after sunrise
- is activted inly during daytime
- every 5 minutes
Try

Code: Select all

return {
	on = { timer = { 'every 5 minutes at daytime' } },
	   
	execute = function(domoticz, _)
           
        if (domoticz.time.secondsSinceMidnight/60) > (domoticz.time.sunriseInMinutes + 60) then
            print ("I should do something now")
        else
            print ("I should wait a little longer")
         end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pgas37
Posts: 115
Joined: Wednesday 06 December 2017 19:44
Target OS: -
Domoticz version:
Contact:

Re: dzvents timer problem

Post by pgas37 »

both thanks for your answer.

I tested the solution of Waaren (no extra dummySwitch), which can be followed with some simple print commands, and it worked well.

Thanks a lot!

regards
Paul
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: dzvents timer problem  [Solved]

Post by McMelloW »

dzVents is far more easier then that. :) :)
I use this for a dzVents script and it works perfect

Code: Select all

	on = {
		timer = { 'every minute between 15 minutes before sunrise and 15 minutes after sunset' } 
	},
So you try this for a change

Code: Select all

	on = {
		timer = { 'every 5 minutes between 60 minutes after sunrise and sunset' } 
	},
The syntax is about this

Code: Select all


	on = {
		timer = { 'interval between first time and second time' } 
	},
Look here for the Timer trigger rules
Thanks to dannybloe
Greetings McMelloW
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest