Page 1 of 1
Blockly query
Posted: Tuesday 20 December 2016 19:12
by daveinhull
Hi,
I've got a problem with a Blockly script which I just don't understand where its going wrong, see attached.
Both parts of the inner If Then Else If execute, i.e. I'm getting two entries in the log and two notifications.
Can anyone see what must be a really obvious mistake.
I'm using the Beta version V3.6207 on a Window 10 machine.
Thanks
Re: Blockly query
Posted: Tuesday 20 December 2016 19:36
by StanHD
Hi, the problem will probably be the "nested" "if" blocks, this does not seem to work in this system. Can you redo with a single "If" block and multiple "else-if" conditions?
(Also the first "if" block is the wrong type. This won't work without any "else-if" conditions, you would have needed the other block without the blue "gear" symbol. Even if this is rectified then the nested "if" block situation still remains.)
Re: Blockly query
Posted: Tuesday 20 December 2016 19:58
by daveinhull
Thanks StanHD,
Yes I knew about the wrong IF block, but thought it would have an effect.
The reason for the wrong IF block was that I originally just had one IF block, something like:
If Doorbell pressed = ON and Dusk Sensor = ON then
etc....
Else If Doorbell pressed = ON and Dusk Sensor = Off then
etc....
end
But the problem was that the Doorbell sensor was always on (it is a Byron bell press) for some reason (I've see other posts about this), so always triggers the script when the Dusk Sensor fires. I initially tried setting up a virtual switch and some LUA code to deal with it, but wanted to just try the code shown in the example first as I thought it should work.
Back to the drawing board....
Thanks again