Page 1 of 1

Repeating set on for X minutes

Posted: Friday 07 October 2016 17:42
by elRedeo
Hello friends,

in blockly, I can use the sentence "set Device = On for 2 minutes".
This is working very well, but for example :
On timestamp 0 I trigger the lamp on for two minutes
On timestamp 60 seconds, I trigger again the lamp on for 2 minutes
On timestamp 120 seconds, the light is off :(

It would be nice, the light will go off at 180 seconds, because at timestamp 60 seconds I fired it again on for 120 seconds.

So I would request this functionalty for blockly :)

Thanks
elRedeo

Re: Repeating set on for X minutes

Posted: Friday 07 October 2016 19:48
by Egregius
Don't use on for...
Set your switch on and use a time script to switch them on depending on one or multiple tast update times.

Re: Repeating set on for X minutes

Posted: Saturday 08 October 2016 9:28
by elRedeo
Thank you for the quick answer.
I am a lua noob, so the question is, are there example scripts?
I searched the wiki without succes. A helping hand would be graceful.

Re: Repeating set on for X minutes

Posted: Saturday 08 October 2016 9:35
by elRedeo
OK, I searched the wron words on the wrong side :)

Will try this : http://www.domoticz.com/forum/viewtopic ... pir#p14415

Re: Repeating set on for X minutes

Posted: Saturday 08 October 2016 9:35
by Egregius
You can also use other languages if you don't know lua. I do everything in PHP.

In my pass2php script that looks like this:

Code: Select all

    if($s['pirgarage']=='Off'&&strtotime($t['pirgarage'])<driemin&&strtotime($t['poort'])<driemin&&strtotime($t['garage'])<driemin&&$s['garage']=='On'&&$s['lichten_auto']=='On')sw($i['garage'],'Off','licht garage');
So the light is switched of when the pir is off for more than 3 minutes, the port is more than 3 minutes opened/closed, the light is more than 3 minutes on and the virtual switch 'auto lights' is on.

Re: Repeating set on for X minutes

Posted: Sunday 09 October 2016 18:56
by elRedeo
OK, simple and much easier in blockly :
Set your switch on without any shut off condition
create a second blckly script for your lighting area with the condition if switch on then switch off after n seconds.

Each time the the PIR triggers the switch on command the countdown timer do branigan begin again :)

Just for know to each other with the same problem .....