Page 22 of 36
Re: Blockly examples
Posted: Thursday 26 January 2017 10:35
by edje1205
Hi tozzke
thanx for quick reply !
Now I have this : see att
Still no action. Strange if I physicly connect a light with the dusk sensor (as it is what kaku does main, or I click dusk sensor) that lamp goes on, but no actions in script
Beside that
In this script will be 'else if' in fact 'do nothing if the light(s) are on yet'. So how can I set blockly in 'do nothing' ?
otherwise (as in your example) , how to say 'do nothing' in lua language ´if connect then end´ or so ?
May be easier in lua ?
Re: Blockly examples
Posted: Thursday 26 January 2017 15:55
by edje1205
This 'seems' to work !

waiting .........
Re: Blockly examples
Posted: Thursday 26 January 2017 20:20
by tozzke
Except I don't think 'Stopped' does anything with a light

Re: Blockly examples
Posted: Thursday 26 January 2017 20:28
by edje1205
Stopped the script at that point maybe ?
Re: Blockly examples
Posted: Thursday 26 January 2017 21:39
by Nautilus
edje1205 wrote:Stopped the script at that point maybe ?
No, that means it is trying to set the switches to state "Stopped"
No need have any separate "stop" commands, it runs when the conditions are met. If you do not need the script to turn the lights off at some point, you don't need the "else if" part at all...
Re: Blockly examples
Posted: Thursday 26 January 2017 22:47
by edje1205
Case closed hm ?
Re: Blockly examples
Posted: Friday 27 January 2017 14:36
by kdalmeijer
Hi guys,
I'm new to the forum and hope you don't mind me asking help for my non-functional blockly. Not entirely true, it does function, but not the way I would expect it to... and what else is new here?
Here's the blockly:

- 2017-01-27 14_22_21-Domoticz.png (37.51 KiB) Viewed 4375 times
It's all about the central ventilation system in the house. I use a Netatmo weather station to read the humidity both in the living room (woonkamer) and in the bathroom (badkamer). Due the the issue I was having with the values from Netatmo, I decided to copy the values to user variables as you can see here:

- 2017-01-27 14_20_37-Domoticz.png (14.96 KiB) Viewed 4375 times
These values are correct and consistent with what the Netatmo app tells me.
Now the thing is that this blockly considers both situations, humidity above 50 and humidity below 50 to be correct as the logfile shows my debug messages:

- 2017-01-27 14_23_12-Domoticz.png (8.26 KiB) Viewed 4375 times
I am absolutely puzzled as to why this is happening...
I hope someone is willing and able to help me with this. Thanks in advance!!
BTW: I used the time<>00:00 to get this event to fire every minute so a spend less time testing whether my blockly works

Re: Blockly examples
Posted: Friday 27 January 2017 15:11
by StanHD
The problem is probably the "Nested" structure you have used. Blockley does not work with nested "If"s.
Can you try re-structuring by repeating the "time<>00:00" criteria within the "if" and "else if" sections therefore losing the outer "If" block?
Re: Blockly examples
Posted: Friday 27 January 2017 15:47
by kdalmeijer
@StanHD You are my absolute hero! Thanks for pointing that out to me!
This is what I ended up with, and it does exactly what I want. I'll expand from here, adding both speeds of the ventilation and adding CO2 measurements from the Netatmo modules. Happy!
Thanks again!

- 2017-01-27 15_44_09-Domoticz.png (35.49 KiB) Viewed 4362 times
Re: Blockly examples
Posted: Friday 27 January 2017 20:36
by StanHD
Re: Blockly examples
Posted: Sunday 29 January 2017 17:07
by tontze
Hi ! My second attempt on making blockly

I cant figure out why this wont work .. Im trying to achieve automatic lights on after sunset.
If i add just motion sensor, it works.
Re: Blockly examples
Posted: Sunday 29 January 2017 17:49
by StanHD
This will only trigger when it is = Sunset (a moment in time) and the motion sensor is on. Try changing to > Sunset and the motion sensor is on. Be aware that > Sunset expires at midnight in Domoticz.

Re: Blockly examples
Posted: Sunday 29 January 2017 17:53
by tontze
StanHD wrote:This will only trigger when it is = Sunset (a moment in time) and the motion sensor is on. Try changing to > Sunset and the motion sensor is on. Be aware that > Sunset expires at midnight in Domoticz.

Gotta try that, i also tried this: didnt work either

Re: Blockly examples
Posted: Sunday 29 January 2017 18:02
by tontze
And changing = to > or < didnt work :/
Re: Blockly examples
Posted: Sunday 29 January 2017 18:08
by StanHD
Ok, you could try making a dummy switch called something like "Is Dark". Set up the switch's timers to on at sunset, off at sunrise. Then use this switch status in your Blockly.
Re: Blockly examples
Posted: Sunday 29 January 2017 18:31
by tontze
StanHD wrote:Ok, you could try making a dummy switch called something like "Is Dark". Set up the switch's timers to on at sunset, off at sunrise. Then use this switch status in your Blockly.
Thnx ! that worked !
Re: Blockly examples
Posted: Monday 30 January 2017 14:58
by tozzke
tontze wrote:StanHD wrote:This will only trigger when it is = Sunset (a moment in time) and the motion sensor is on. Try changing to > Sunset and the motion sensor is on. Be aware that > Sunset expires at midnight in Domoticz.

Gotta try that, i also tried this: didnt work either

Somehow some people manage to mix the blocks in a way it doesn't work
It isn't that difficult... Mind the brackets
Code: Select all
If [[[Time >= [Sunset]] or [Time <= [Sunrise]]] and [[Motion] = [On]]]
Do [Set [Kitchen lights] = [Off] After [3*] seconds]
* Domoticz/blockly doesn't allow timed events shorter than 3 seconds
Re: Blockly examples
Posted: Monday 30 January 2017 15:25
by tontze
tozzke wrote:tontze wrote:StanHD wrote:This will only trigger when it is = Sunset (a moment in time) and the motion sensor is on. Try changing to > Sunset and the motion sensor is on. Be aware that > Sunset expires at midnight in Domoticz.

Gotta try that, i also tried this: didnt work either

Somehow some people manage to mix the blocks in a way it doesn't work
It isn't that difficult... Mind the brackets
Code: Select all
If [[[Time >= [Sunset]] or [Time <= [Sunrise]]] and [[Motion] = [On]]]
Do [Set [Kitchen lights] = [Off] After [3*] seconds]
* Domoticz/blockly doesn't allow timed events shorter than 3 seconds
Thats good to know

Was that the problem with my blockly ? I still dont see anything wrong with it (besides that 1sec that i know now).
Oh, just now i remembered that i used 1sec delay with motion to start lights (without sunset) and it worked ?
Re: Blockly examples
Posted: Monday 30 January 2017 15:39
by tontze
Oh, now i see it

Open brackets left behind right ?
Re: Blockly examples
Posted: Monday 30 January 2017 16:29
by tozzke
Sunset/rise have to be linked
into the Time-blockly
