Conditional not evaluated

Moderator: leecollings

Post Reply
juankar
Posts: 221
Joined: Saturday 30 August 2014 20:20
Target OS: Linux
Domoticz version: 4.
Location: Spain
Contact:

Conditional not evaluated

Post by juankar »

Hello
I have this blocky script
vestibulo.jpg
vestibulo.jpg (95.76 KiB) Viewed 669 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?
wouterlet
Posts: 109
Joined: Tuesday 02 October 2018 20:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Conditional not evaluated

Post 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...
juankar
Posts: 221
Joined: Saturday 30 August 2014 20:20
Target OS: Linux
Domoticz version: 4.
Location: Spain
Contact:

Re: Conditional not evaluated

Post 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
RogerSch
Posts: 51
Joined: Saturday 04 April 2015 10:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Conditional not evaluated

Post 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?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Conditional not evaluated

Post 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.. :)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
juankar
Posts: 221
Joined: Saturday 30 August 2014 20:20
Target OS: Linux
Domoticz version: 4.
Location: Spain
Contact:

Re: Conditional not evaluated

Post by juankar »

I nmy opinion, if you need a complex conditional sentence or complex script it's better to use dzVents, Lua or Python.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest