Page 1 of 1

Conditional not evaluated

Posted: Sunday 23 February 2020 20:46
by juankar
Hello
I have this blocky script
vestibulo.jpg
vestibulo.jpg (95.76 KiB) Viewed 668 times
The logic is

Code: Select all

If (vest-mov== on and vest-lux <20)
    {
       set vestibulo = on
       if (time > sunset and pasillo == off )
            set pasillo = off
   }
else 
    if (vest-mov== off and vestibulo == on)
        set vestibulo = off
  
In plain text: if a movement sensor is on and it's dark, then turn vestibulo light on and if time is after sunset then turn light pasillo on too.
The problem is:

Code: Select all

       if (time > sunset and pasillo == off )
            set pasillo = off
is evaluate always to TRUE, so it always set vestibulo and pasillo to on when the movement sensor is on and light is under 20.
I can not understand why this logic doesn´t work
Any idea?

Re: Conditional not evaluated

Posted: Thursday 27 February 2020 21:08
by wouterlet
Sorry you can't use an "if->do" in another "if->do anymore. I understooth that it was possible years ago, but not anymore...

Re: Conditional not evaluated

Posted: Thursday 27 February 2020 21:50
by juankar
Thanks for your answer
I solved my problem with a huge conditional.
So this is a problem of Blocky, I cannot understand the reason of this behavior, it's a basic program construction in any language.
Blocky is a good idea for no-programmers, but if it doesn't work....
I think that dZevents will be the language for scripts in Domoticz, at least in my home.
Bye

Re: Conditional not evaluated

Posted: Saturday 16 May 2020 7:23
by RogerSch
wouterlet wrote: Thursday 27 February 2020 21:08 Sorry you can't use an "if->do" in another "if->do anymore. I understooth that it was possible years ago, but not anymore...
Sorry for the late response. But is this really true. Who can confirm this?

Re: Conditional not evaluated

Posted: Saturday 16 May 2020 11:56
by waaren
RogerSch wrote: Saturday 16 May 2020 7:23
wouterlet wrote: Thursday 27 February 2020 21:08 Sorry you can't use an "if->do" in another "if->do anymore. I understooth that it was possible years ago, but not anymore...
Sorry for the late response. But is this really true. Who can confirm this?
There are at least 50 posts on this forum confirming that it does not work. I cannot confirm it ever worked though.. :)

Re: Conditional not evaluated

Posted: Saturday 16 May 2020 13:03
by juankar
I nmy opinion, if you need a complex conditional sentence or complex script it's better to use dzVents, Lua or Python.