Page 1 of 1

Blocky program don't work

Posted: Wednesday 11 September 2019 10:45
by phoenixblue
Hi,

I have 2 different blocky programs to send an message when the door is longer open then x time and to send an message when it's closed.

I use for this an extra "marker" that I can set to on and off.

But when the door is closed I get always the message the same time that the door is open and closed.

Somebody an idea what I'm doing wrong.


ImageImage

Re: Blocky program don't work

Posted: Wednesday 11 September 2019 12:56
by DaanT
Hi phoenixblue,

I hope I understand you correctly, here's my view.
The 600s timer is still going even if you closed the door.
As soon as the door opens, in any case the marker will go to ON after 600s.
And right after it the door is already close and it will switch back to OFF, giving you the double message in an instant.

Here's what i would do:
IF "Door open" and "Marker OFF"
DO "Marker on after 600"
ELSEIF "Door open" and "Marker ON" - triggered after 600s
DO "send message: door open"
ElSEIF "Door closed" and "Marker ON" - triggered after 600s
DO "Marker off"
ElSEIF "Door closed" and "Marker OFF" - trigger if door closed within 600s
DO "log: closed in time"

Downside, if you try to close the door and it fails, it will not retrigger this event because for Domoticz the door switch did not change state and the event does not get triggered again. That's of course a minor detail as you will double check physically it is closed.

Kind regards
Daan

Re: Blocky program don't work

Posted: Wednesday 11 September 2019 13:08
by tozzke
The timer 'After 600 seconds' is still active even though you close the door before that timer ends. So it'll turn on 'Deur marker' after 600 seconds regardless and when it does, the second blockly is triggered because of the condition 'and Deur marker = On'

If you want to do it in Blockly then you should disable the notification on the switch 'Deur marker' (you will need this switch though because Domoticz/Blockly won't trigger on variables correctly) and make it into one blockly to prevent this so you'll get something like this:

Image

I've tested this and it seems to work just fine (you should change the 10 seconds to your desired delay).
I get a notification after the given time that the door is opened too long, I don't get one when I close it before the timer/delay ends and I do get one again after it's closed after being open too long (so not every close of the door as you'd get with a notification on the switch itself)