Blockly Help: When are blocks executed and help with scenario

Moderator: leecollings

Post Reply
DrNick
Posts: 2
Joined: Monday 11 March 2019 16:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Netherlands
Contact:

Blockly Help: When are blocks executed and help with scenario

Post by DrNick »

Hey there,

I'm new to the forum and have spent some fair amount of time trying to configure (multiple) blockly events,
some for test, some for real scenario's but i fail to see why certain things don't work as expected.

I've created 2 test Blockly's to test some of the inner workings,
SetDayVar: to set a uservariable to a certain value based on what day it is. (to simplify another blockly lateron)
Only executed once a day on certain time, to prevent repetition.

GetDayVar: to see if i can use the uservariable in if statements to make it work.

Included the log from the test time frame.
Spoiler: show
2019-03-11 09:17:22.655 Status: EventSystem: reset all events... <-- Changing Event
2019-03-11 09:18:00.179 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:18:00.179 Status: 2
2019-03-11 09:18:06.877 EventSystem: Event triggered: GetDayVar_2 <-- Manual Changing User Variable To '1'
2019-03-11 09:18:06.878 EventSystem: Event triggered: GetDayVar_4
2019-03-11 09:18:06.878 EventSystem: Event triggered: GetDayVar_5
2019-03-11 09:18:06.877 Status: DailOnVar=1
2019-03-11 09:18:06.878 Status: DailyOnVar<=2
2019-03-11 09:18:06.878 Status: DailyOnVar Not= 2
2019-03-11 09:19:00.188 EventSystem: Event triggered: GetDayVar_1 <-- 'Normal Timed execute'
2019-03-11 09:19:00.188 Status: 1
2019-03-11 09:20:00.197 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:20:00.197 Status: 1
2019-03-11 09:21:00.205 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:21:00.206 Status: 1
2019-03-11 09:22:00.214 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:22:00.214 Status: 1
2019-03-11 09:23:00.223 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:23:00.223 Status: 1
2019-03-11 09:24:00.231 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:24:00.232 Status: 1
2019-03-11 09:24:09.099 Status: EventSystem: reset all events... <-- Changing SetDayVar Event
2019-03-11 09:25:00.240 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:25:00.240 EventSystem: Event triggered: SetDayVar_1
2019-03-11 09:25:00.240 Status: 1 <-- GetDayVar_1
2019-03-11 09:25:00.241 Status: SetDayVar: Maandag, Woensdag, Vrijdag <-- SetDayVar_1 (Set Variable to '2')
2019-03-11 09:26:00.248 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:26:00.248 Status: 2
2019-03-11 09:27:00.257 EventSystem: Event triggered: GetDayVar_1
2019-03-11 09:27:00.257 Status: 2
2019-03-11 09:27:55.515 EventSystem: Event triggered: GetDayVar_3 <-- Manual Changing User Variable To '3'
2019-03-11 09:27:55.516 EventSystem: Event triggered: GetDayVar_5
2019-03-11 09:27:55.515 Status: DailyOnVar>=2
2019-03-11 09:27:55.516 Status: DailyOnVar Not= 2
2019-03-11 09:28:00.266 EventSystem: Event triggered: GetDayVar_1 <-- 'Normal Timed execute'
2019-03-11 09:28:00.266 Status: 3
2019-03-11 09:28:48.948 EventSystem: Event triggered: GetDayVar_3 <-- Manual Changing User Variable To '2'
2019-03-11 09:28:48.949 EventSystem: Event triggered: GetDayVar_4
2019-03-11 09:28:48.949 EventSystem: Event triggered: GetDayVar_6
2019-03-11 09:28:48.948 Status: DailyOnVar>=2
2019-03-11 09:28:48.949 Status: DailyOnVar<=2
2019-03-11 09:28:48.949 Status: DailyOnVar=2
2019-03-11 09:29:00.275 EventSystem: Event triggered: GetDayVar_1 <-- 'Normal Timed execute'
2019-03-11 09:29:00.275 Status: 2
As anyone can see,
On 09:18:00 GetDayVar executes with only 1 log: 2 (The output the variable itself, rule1)
On 09:18:06 i Manual change the UserVar to 1, 3 entries in the log (Rule2,4&5), But i'm Missing the first one, rule1
On 09:19:00 a normal run occurs and just prints 1 thing, 1 from rule1 (why doesn't it print rule2,4&5 like above??)

On 09:24:09 i made a change to SetDayVar to trigger at a certain time, to change the value to 2 by the system again
On 09:25:00 both rules1 from GetDayVar and SetDayVar are executed (but not the remaining 5 from GetDayVar)

2 next events i manually change the UserVariable to 3 and to 2, witch tiggers the rules3,4,5,&6 BUT not rule1!

How does this work in Blockly, because it looks like i cant GET the value of an UserVariable after it has been set,
it seems that you are unable to work with later on..

Maybe this is again some limitation of Blockly, but this limits in the thing i want to accomplish with a little more complicated blockly light setting.

That brings me to problem2, or how to accomplish the next thing (Example: DailyOn)
On Some days i want lights to turn with SunSet but not before 18:00 (because i wont be home then..)
On the other days i want the lights to turn on with SunSet,
And in the end Turn all the lights off when its a certain time.

i Noticed (in testing) that >= SunSet and >= SunRise is always true, so this wont work correct .. ever.
Using = SunSet you only have 1 time a day the event triggers, but during the winter SunSet is as early as 16:30 but i wont be home until after 18:00,
so i dont need my lights to be on during that Period of time. In my scenario i think i need to use the AND statement for this one.

On the other note, i maybe want some lightning in the Summer even before SunSet and there i guess i can use if=Sunset OR time>21:30.

Long story, but anyone with some hints or clues?
Thnx in advance.

Edit 16:53: I don't have actual hardware at this moment, I’m currently using dummy's to test certain scenarios before i buy some stuff that won't work as i suspected it should work.
Attachments
Blockly-SetDayVar.PNG
Blockly-SetDayVar.PNG (43.93 KiB) Viewed 577 times
Blockly-GetUserVar.PNG
Blockly-GetUserVar.PNG (49.38 KiB) Viewed 577 times
Blockly-DailyOn.PNG
Blockly-DailyOn.PNG (35.53 KiB) Viewed 577 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests