Blocky runs in continous loop until no condition exist

Moderator: leecollings

Post Reply
sash
Posts: 9
Joined: Thursday 28 February 2019 16:58
Target OS: Linux
Domoticz version:
Contact:

Blocky runs in continous loop until no condition exist

Post by sash »

Hi there your blocky runs in a continuous loop until all condition do not exist which makes it kind of silly for the if/else statements as it makes it kind of useless for alot of things
example: a dimming control
xiaomi cube:

Code: Select all

      if "cube" = "rotate right"  and "dimmer" = set level 20%
     do "dimmer" = level 1%
     else if "cube" = "rotate right"  and "dimmer" = set level 40%
     do "dimmer" = level 20%
     else if "cube" = "rotate right"  and "dimmer" = set level 60%
     do "dimmer" = level 40%
     else if "cube" = "rotate right"  and "dimmer" = set level 80%
     do "dimmer" = level 60%
     else if "cube" = "rotate right"  and "dimmer" = set level 100%
     do dimmer = level 80%
instead of finishing when the first condition is met it will start from the top again and loop trough until all conditions are met and it can not do any more . so it always ending up on the lowest setting . you can see it stepping through if you add a timer condition on the do

Ie:

Code: Select all

    do "dimmer" = level 80% after 2 seconds 
perhaps this is by design or a bug. if by design can you introduce an extra blocky logic just to introduced an end loop condition.
ie:

Code: Select all

      if "cube" = "rotate right"  and "dimmer" = set level 20%
     do "dimmer" = level 1%
     stop
     else if "cube" = "rotate right"  and "dimmer" = set level 40%
     do "dimmer" = level 20%
     stop
     else if "cube" = "rotate right"  and "dimmer" = set level 60%
     do "dimmer" = level 40%
     stop
     else if "cube" = "rotate right"  and "dimmer" = set level 80%
     do "dimmer" = level 60%
     stop
     else if "cube" = "rotate right"  and "dimmer" = set level 100%
     do dimmer = level 80%
     stop
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest