if_else statement failure

Moderator: leecollings

Post Reply
nikos
Posts: 4
Joined: Wednesday 17 January 2018 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

if_else statement failure

Post 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??
Attachments
Selection_003.png
Selection_003.png (35.9 KiB) Viewed 848 times
cogliostrio
Posts: 77
Joined: Sunday 06 September 2015 11:58
Target OS: Linux
Domoticz version:
Contact:

Re: if_else statement failure

Post 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
nikos
Posts: 4
Joined: Wednesday 17 January 2018 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: if_else statement failure

Post 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
Post Reply