Page 1 of 1
Timer block in "Blockly"
Posted: Sunday 12 February 2017 21:51
by Ptje
Hello,
I make use from blockly to make events. I want to set off the heathing in the house, when the door is open for more then 60 seconds. There is not a sollution in blockly to do that ? No the heather gets of when I open the door en gets on when I close it. That works, but it is not so charming.
Is it not possible to make a block, that counts down in seconds. When counter=0 and that you can set the value for the counter in seconds.
Greetings,
Peter
Re: Timer block in "Blockly"
Posted: Monday 13 February 2017 1:21
by sion
Hi.
The best way to do this I beleive would be to use Lua or bash script. I'm no familiour enough with them to help, but you could probably find a work around using block and a. Couple of virtual switches. Something like this;
You have a switch "door" which is either on or off depending if the door is open or closed.
Create another virtual switch " counter".
Blocky 1:
If :door=on
Set: counter on after 60 seconds.
Then the second blocky will check if the door is still open after 60 seconds.
Blocky 2
If: door =on And. Counter = on
Set: heating on.
Set: counter off.
Else if : door = off And counter = on
Set counter off.
This would not account for if the door was closed, and then open again inside the 60 seconds though.
Just if the door is open, and is then also open 60 seconds later. May help though

Re: Timer block in "Blockly"
Posted: Monday 13 February 2017 19:52
by Ptje
Hi,
Thanks for your reply. Your solution works fine !! I'm going to use this. When the door opens en closes, Then still the virtual switch "counter" still gets on and at the same time off. That results only in a cosmetic problem.
Greetings,
Peter
Re: Timer block in "Blockly"
Posted: Monday 13 February 2017 21:34
by sion
You could try an additional blocky:
If door is closed,
Set timer off.
Or possibly a Json command in the off action of the door switch.
This may over ride the initial 60 second timer??
I'm not sure if this would work though am not home to test.
Re: Timer block in "Blockly"
Posted: Tuesday 04 April 2017 9:04
by sisaenkov
Unfortunatelly, additional timer device will lead to high memory usage every time it was triggered. More devices - more memory consumption. As a result - Domoticz freezes.
P.S.
This issue was resolved in latest release.