Page 1 of 1

blockly script, but the time option does not work ?

Posted: Friday 15 June 2018 10:59
by TheCub3
Hi all,

i'am not really handy with Blockly (yet) and i hope maybe u can help me with a blockly script
notwork.jpg
notwork.jpg (37.25 KiB) Viewed 2380 times
But it dus not work ?, or better it works to good. becourse i dussent matter when i open the door i wil allways get a push message and e-mail
what am I doing wrong ?


Tnx
-A

Re: blockly script, but the time option does not work ?

Posted: Saturday 16 June 2018 9:47
by Denny64
First of all you don't need to use two IF statements.

IF voordeur = Open AND Time > 22:30 AND Time < 07:00

To prevent Domoticz sending repeating messages, with blockly you must use a user variable. Make one and call it "Door" using "Open" and "Closed" like string.

Now you can blockly in this way:

IF voordeur = Open AND Door = Closed AND Time > 22:30 AND Time < 07:00
DO Door = Open
Send camera snapshot...
Send notification with subject...
Else IF voordeur = Closed AND Door = Open AND Time > 22:30 AND Time < 07:00
Do Door = Closed

Re: blockly script, but the time option does not work ?

Posted: Saturday 16 June 2018 10:04
by StanHD
Because the day ends at midnight and then resets , your time statement should contain "Or", not "And".

Example: Time >21:00 Or Time <07:00

Re: blockly script, but the time option does not work ?

Posted: Saturday 16 June 2018 10:14
by Denny64
Of course, I forget it...

But this does not solve the recursive sending message until the door is closed.

Re: blockly script, but the time option does not work ?

Posted: Saturday 16 June 2018 12:53
by TheCub3
he Guy's

firt tnx for the time to think this over, is this what you mean ?.
dit01.png
dit01.png (37.19 KiB) Viewed 2353 times
it seem to me a bit overdone ?, but oke iám een noob in Blockly

-A

Re: blockly script, but the time option does not work ?

Posted: Saturday 16 June 2018 13:02
by StanHD
I have never successfully nested "If" blocks. I don't think that will work. Try re-writing as per @Denny64 above using a single "If - Else If".

Have a look at some blockly examples on the forum. You will see how to structure the blocks. Although it has its limitations I have around 40 blockly scripts running successfully for years now. You will soon get the hang of it.

Re: blockly script, but the time option does not work ?

Posted: Saturday 16 June 2018 14:15
by TheCub3
StanHD wrote: Saturday 16 June 2018 13:02 I have never successfully nested "If" blocks. I don't think that will work. Try re-writing as per @Denny64 above using a single "If - Else If".

Have a look at some blockly examples on the forum. You will see how to structure the blocks. Although it has its limitations I have around 40 blockly scripts running successfully for years now. You will soon get the hang of it.
Hi "stan",

this blockly script is working,
werkt01.jpg
werkt01.jpg (35.59 KiB) Viewed 2337 times
maybe you or other got some tips or changes ?

-A

Re: blockly script, but the time option does not work ?

Posted: Saturday 16 June 2018 16:07
by Denny64
This is the right blockly to avoid recursive message:
Schermata a 2018-06-16 15-21-53.jpg
Schermata a 2018-06-16 15-21-53.jpg (107.37 KiB) Viewed 2335 times
Don't forget to create a user variable called "Door".

Re: blockly script, but the time option does not work ?

Posted: Tuesday 19 June 2018 18:24
by TheCub3
i really dont understand it anymore,

i made:
snaphemniet.jpg
snaphemniet.jpg (45.06 KiB) Viewed 2284 times
so i tested it yesterday, change the first time to 17:30 open the door and yes i get a push message and e-mail .
so i change the time back to 22:30 and open the door again, yes no message so the time is working, so far so fine .....
at 22:30 i open the door YES again a message zo the time settings are really working (so I thought) ... next morning on 07:00 i open the door.
and again a push message and a email. I thought ok so thats working.... but today on 12:00 a clock my girlfriend get home opens the door.
and i get a message huh ?..... why thats not posible ...

so i really dont know it anymore, i made about 10 differents blockly setups and everytime as I thought yes thats the right one its not.

what i'am doing wrong ?.

Re: blockly script, but the time option does not work ?

Posted: Tuesday 19 June 2018 22:46
by cobra045
Hi TheCub3,

your blockly is wrong.

use < instead of >

2018-06-19_22h39_29.png
2018-06-19_22h39_29.png (136.57 KiB) Viewed 2272 times
Kind regards

Cobra045

Re: blockly script, but the time option does not work ?

Posted: Wednesday 20 June 2018 12:16
by TheCub3
cobra045 wrote: Tuesday 19 June 2018 22:46 Hi TheCub3,

your blockly is wrong.

use < instead of >


2018-06-19_22h39_29.png

Kind regards

Cobra045
ooh my G#D, that cant be it :o ... sorry Cobra045 i wil change it and test it again...

tnx

Re: blockly script, but the time option does not work ?

Posted: Wednesday 20 June 2018 19:20
by TheCub3
cobra045 wrote: Tuesday 19 June 2018 22:46 Hi TheCub3,

your blockly is wrong.

use < instead of >


2018-06-19_22h39_29.png

Kind regards

Cobra045
hi all,

Just dit a test, but still the same issue Blockly is now:
helaas01.jpg
helaas01.jpg (47.33 KiB) Viewed 2230 times
and i opened the door at 19:17 and i got a push message and a e-mail, i dont know why but i cant get the time settings working.
what i'am i doing wrong, i dont know it anymore.

-A

Re: blockly script, but the time option does not work ?

Posted: Wednesday 20 June 2018 19:35
by mrf68
Try simplifying your blockly. The “if else/if” block without an else/if usualy doesn’t work. And the second “and” won’t work, because time cannot be “> 22:30 AND < 08:00”. Create a blockly for the first period (>22:30 and <23:59), then create a second blockly for the second period (>00:00 and <08:00).

Re: blockly script, but the time option does not work ?

Posted: Wednesday 20 June 2018 19:38
by TheCub3
mrf68 wrote: Wednesday 20 June 2018 19:35 Try simplifying your blockly. The “if else/if” block without an else/if usualy doesn’t work. And the second “and” won’t work, because time cannot be “> 22:30 AND < 08:00”. Create a blockly for the first period (>22:30 and <23:59), then create a second blockly for the second period (>00:00 and <08:00).
tnx i wil try that, i just made
werkt02.jpg
werkt02.jpg (37.49 KiB) Viewed 2226 times
and this works indeed, i wil made a second one voor the night tnx i wil let you know if this works