Page 1 of 1

Blockly: Alarm function not working

Posted: Sunday 15 October 2017 12:02
by Mace
I'm trying to get a simple 'alarm' function working with Blockly.
Hardware used:
Xiaomi Motion Sensors
Xiaomi Gateway 2

Switches (virtual) used:
Is Dark Switch (On= 1 minute after sunset, Off= 1 minute after sunrise)
Motion LR Detected (On when at least 1 motion detector detects movement, Off when no movement is reported by all motion sensors)

Usecase:
I want to get an alarm notification and switch the light on the Gateway on for 5 minutes, if motion is detected by either Motion Sensor and it is after dark.

Blockly's:

Motion detection:
Motion Detection.PNG
Motion Detection.PNG (31.91 KiB) Viewed 1030 times
Alarm:
Alarm.PNG
Alarm.PNG (25.8 KiB) Viewed 1030 times
The 'Is Dark Switch' and 'Motion Detected LR' are working fine and trigger on and off at the right times, but alarm isn't triggered.

I've chosen for the 'Device' setting for both blocklys, can't imagine that's not the right setting.

Any one that can help me?

Re: Blockly: Alarm function not working

Posted: Sunday 15 October 2017 13:32
by mrf68
I think the Alarm blockly has the wrong if/do block. It looks like you used the if/then/else if block, but in this case you need the other one without the else/if possibility.

Re: Blockly: Alarm function not working

Posted: Sunday 15 October 2017 20:59
by Mace
Thanks.....stupid mistake...Shame on me.... ;)