Blockly query

Moderator: leecollings

Post Reply
daveinhull
Posts: 22
Joined: Thursday 20 August 2015 11:30
Target OS: Windows
Domoticz version: V2.2657
Location: UK
Contact:

Blockly query

Post 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
Attachments
2016-12-20_180914.png
2016-12-20_180914.png (26.98 KiB) Viewed 599 times
Domoticz running on Windows 10 x64 Shuttle PC
RFComm, 9wall dimmers, 4dual sockets, 3x3way relays, 1x1way relay, 4PIRs, 2magnetic switches, 1radiator valve, WiFi link, coiler switch and controller, compatible security system, & lots of patience
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly query

Post 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.)
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
daveinhull
Posts: 22
Joined: Thursday 20 August 2015 11:30
Target OS: Windows
Domoticz version: V2.2657
Location: UK
Contact:

Re: Blockly query

Post 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
Domoticz running on Windows 10 x64 Shuttle PC
RFComm, 9wall dimmers, 4dual sockets, 3x3way relays, 1x1way relay, 4PIRs, 2magnetic switches, 1radiator valve, WiFi link, coiler switch and controller, compatible security system, & lots of patience
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest