Timer options

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

Moderator: leecollings

Post Reply
User avatar
dk78
Posts: 26
Joined: Monday 07 March 2016 15:50
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Veldhoven
Contact:

Timer options

Post by dk78 »

Hi,

I'm wondering what I'm doing wrong with the timer options of the dzVents lua scripts. I want to trigger a script that will turn on the lights. This script has to start 30 minutes before sunset at midnight every 5 minutes. Depending on a luxsensor in the logic of the script. I had 'at nighttime' but today it was cloudy and rainy, so the lights turned on a bit to late. That's why I want to use to '30 minutes before sunset', but also the 'every 5 minutes' because of the remark that Domoticz can skip a beat. I think the 'at nighttime' is a bit to much, but don't know for sure. I don't know how to get it in the correct syntax.

I tried several options which I can't recall at the moment, but the one I think is the correct one didn't work either:
{ '30 minutes before sunset every 5 minutes' }

But the only thing that is working with the 5 minute option is:
{ 'at nighttime every 5 minutes' }

Can someone help me with this '30 minutes before sunset' with 'every 5 minutes' combination? Or is this the only combination that isn't working together?
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Timer options

Post by dannybloe »

First of all I haven't tested all syntactical combinations of the time rules so it is likely that not every combination works. That said the 'xx before sunset' rule is a moment and not an interval so that cannot be combined with an every clause. So for now you are stuck with multiple rules until I make it so that you can define intervals with the before clauses. You can combine several rules though and you can even create additional time functions:

Code: Select all

on={
 timer={
   'every 5 minutes at nighttime',
   function(domoticz) 
     -- logic here that could use domoticz.time.sunsetInMinutes etc
     -- return true to execute the script
   end
 }
}
Hope this helps.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
dk78
Posts: 26
Joined: Monday 07 March 2016 15:50
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Veldhoven
Contact:

Re: Timer options

Post by dk78 »

Thanks for the reply. I thought that it didn't work the way I wanted. Tested many ways yesterday, but thought at the end it was a 'one time trigger' and not a starting point for running the script.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest