Page 1 of 1

if_else statement failure

Posted: Friday 26 January 2018 13:42
by nikos
Hi all,

I am trying to simulate the ELSE statement that is missing from the Domoticz blockly by the blockly below.
The 'A_kid@home' switch is fired from the SystemAliveChecker(Ping) on a mobile phone
The Variable_set_to_1 is set to integer 1 thus always TRUE

The IF part works fine, and the TestLlight switches ON when "A_kid@home" switches ON
The ELSEIF statement fails to fire when "A_kid@home" switches to OFF. As a result the TestLight remains ON!!
The same result occurs when I change the user variable with a virtual switch permanently set to ON

Could anyone shed some light here??

Re: if_else statement failure

Posted: Friday 26 January 2018 17:44
by cogliostrio
You can work around it by adding all the variables to each if-test.

Try like this:
If day=friday and kid=on and variable=0
then light=on
If day=friday and kid=on and variable=1
then light=off

Re: if_else statement failure

Posted: Sunday 28 January 2018 18:30
by nikos
Thanks cogliostrio, adding a second always true variable to the event seems to be doing the trick. It is not really an ELSEIF statement but just another IF.
I am new here and I am trying to make sense of the domoticz blockly. It lacks the google blockly functionality but it can still work for simple tasks.
Thanks again