blockly script, but the time option does not work ?

Moderator: leecollings

Post Reply
TheCub3
Posts: 30
Joined: Saturday 24 February 2018 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

blockly script, but the time option does not work ?

Post 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 2381 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
User avatar
Denny64
Posts: 53
Joined: Friday 03 February 2017 11:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Italy
Contact:

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

Post 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
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

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

Post 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
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
User avatar
Denny64
Posts: 53
Joined: Friday 03 February 2017 11:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Italy
Contact:

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

Post by Denny64 »

Of course, I forget it...

But this does not solve the recursive sending message until the door is closed.
TheCub3
Posts: 30
Joined: Saturday 24 February 2018 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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 2354 times
it seem to me a bit overdone ?, but oke iám een noob in Blockly

-A
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

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

Post 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.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
TheCub3
Posts: 30
Joined: Saturday 24 February 2018 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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 2338 times
maybe you or other got some tips or changes ?

-A
User avatar
Denny64
Posts: 53
Joined: Friday 03 February 2017 11:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Italy
Contact:

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

Post 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 2336 times
Don't forget to create a user variable called "Door".
TheCub3
Posts: 30
Joined: Saturday 24 February 2018 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by TheCub3 »

i really dont understand it anymore,

i made:
snaphemniet.jpg
snaphemniet.jpg (45.06 KiB) Viewed 2285 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 ?.
cobra045
Posts: 46
Joined: Friday 12 February 2016 20:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

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

Post 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 2273 times
Kind regards

Cobra045
TheCub3
Posts: 30
Joined: Saturday 24 February 2018 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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
TheCub3
Posts: 30
Joined: Saturday 24 February 2018 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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 2231 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
mrf68

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

Post 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).
TheCub3
Posts: 30
Joined: Saturday 24 February 2018 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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 2227 times
and this works indeed, i wil made a second one voor the night tnx i wil let you know if this works
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest