Page 1 of 1

Controlling ON time of a switch.

Posted: Sunday 28 August 2016 21:44
by JonyBCN
I do not know if it is possible, but I definitely have not managed to do in Blockly.
I need to control the time it takes endencido a switch.
 For example: If the switch room takes on 15 minutes, turn off the switch office.
Some help?

Re: Controlling ON time of a switch.

Posted: Monday 29 August 2016 7:46
by Egregius
I think you'll need to explain better.
Do you mean turn of a light if another light is on for more then 15 minutes?

Re: Controlling ON time of a switch.

Posted: Monday 29 August 2016 10:21
by JonyBCN
something like that, yes. I want to control the time it takes on a switch to act accordingly. for example, "if X switch takes time off, then Y Z switch acts form.

Re: Controlling ON time of a switch.

Posted: Monday 29 August 2016 11:01
by Egregius
I do that all the time to switch off lights that were switched by a PIR, or when I leave my home etc.

Parts of my pass2php script:

Code: Select all

if(strtotime($t['pirkeuken'])<tweemin && strtotime($t['wasbak'])<tweemin && $s['pirkeuken']=='Off' && $s['wasbak']=='On' && $s['werkblad']=='Off' && $s['keuken']=='Off' && $s['kookplaat']=='Off')sw($i['wasbak'],'Off');
 

Code: Select all

$items=array('denon','bureel','tv','tvled','kristal','eettafel','zithoek','garage','terras','tuin','voordeur','keuken','werkblad','wasbak','kookplaat','sony');
foreach($items as $item) if($s[$item] != 'Off' && strtotime($t[$item]) < time-$uit) sw($i[$item],'Off');
 
I can only suggest to learn one programming language and start scripting, a whole world of possibilities will open...

Re: Controlling ON time of a switch.

Posted: Saturday 03 September 2016 15:24
by JonyBCN
I tried with LUA and I must confess that I am a useless for it. Also, I think it would be a good option to implement Blockly, it is an excellent tool for those who do not know programming.

Re: Controlling ON time of a switch.

Posted: Saturday 03 September 2016 16:20
by Egregius
This isn't lua, it's php. Much easier.