If is all time true

Post Reply
warcz
Posts: 4
Joined: Thursday 29 March 2018 10:43
Target OS: -
Domoticz version:
Contact:

If is all time true

Post by warcz » Sunday 01 July 2018 22:03

Hi,

I have problem. When i create:

vypinac = 0;
if vypinac == 1000 then "Nikdy se nestane";

I created "IF" that is not true, but the program always processes it. What is wrong ?

Thank You
Attachments
2018-07-01_2037.png
2018-07-01_2037.png (14.31 KiB) Viewed 800 times
2018-07-01_2037_001.png
2018-07-01_2037_001.png (23.01 KiB) Viewed 800 times

Nautilus
Posts: 780
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: If is all time true

Post by Nautilus » Friday 20 July 2018 8:22

Hi, unfortunately nested ifs do not work in blockly (at least the last I checked). Also all "else if"'s are executed even if previous ones are "true" which means you need to be very careful when setting the conditions. Finally, in cases where you only have one "If...do" (no else if), you shouldn't use the block with the small blue gear icon.

warcz
Posts: 4
Joined: Thursday 29 March 2018 10:43
Target OS: -
Domoticz version:
Contact:

Re: If is all time true

Post by warcz » Saturday 21 July 2018 11:02

Is there a chance that this problem will be solved?

it would be enough IF and ELSE. I need create "case". If X=1 do ... If X=2 do ... if X=3 do ...

User avatar
mrf68
Posts: 270
Joined: Monday 23 February 2015 13:45
Target OS: Windows
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: If is all time true

Post by mrf68 » Saturday 21 July 2018 13:11

Create separate blocks: one for If x=a do something, one for If x=b do something else and a third one for If x = c do something new. And don’t use the If Do block with the blue square in the upper left corner when using single if/do statements. Keep the logic as simple as possible, the chances that it works are higher and it is easier to troubleshoot.

Nautilus
Posts: 780
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: If is all time true

Post by Nautilus » Monday 23 July 2018 1:03

warcz wrote:
Saturday 21 July 2018 11:02
Is there a chance that this problem will be solved?
I guess there's a chance (if you refer to nested if's not working and all else if's being executed) but the issue has been there for years so instead of waiting for a fix, I'd either try to build and commit the fix myself or set the conditions so that the outcome is what you need. Or even better, switch to Lua / dzVents :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests