Page 1 of 1

Timer options

Posted: Wednesday 02 August 2017 22:40
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?

Re: Timer options

Posted: Thursday 03 August 2017 9:55
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.

Re: Timer options

Posted: Thursday 03 August 2017 10:34
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.