Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,


as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.


As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!



Smart Home Forum by FIBARO Team

  • 0

Confused with AND



Dear all,


I am progressing with the HC2, adding sensors, actors, the like. Also some scripts. But there is one BIG surprise for me. This is how the AND operator is interpreted in block scenes.

 Trying to accomplish scripts that check for more than 1 criterion to be met, and only execute the act if all conditions are met, i grouped the conditions with the AND tag, as for instance shown in the image. The idea being that in the morning (at 6.12 on weekdays) the light will only be started if it is dark (ie a light sensor registers values of 6 and below).


However, if i in the evening turn off the light, the sensor value falls below 7, and the script runs, executing the wakeup scene and turning on the bathroom lights. Obviously the trigger conditional in the script is met. But how? it is not a weekday morning at 6.12.


So I checked. If I delete the line for 6.12 weekday, obviously the script runs anytime the sensor value drops below 7: that is correct. If I delete the line for the light sensor, then the script is executed at weekdays at 6.12. Correct as well. If I toggle the command to OR, it executes either when the sensor drops below 7, or it is 6.12 in the morning: correct. But if I set it to AND again (and save, and revisit the script to see if it is set to AND...), it executes as if there is OR. This I feel is not so correct. I'm not the guy to scream BUG all the time, but do feel confused... Anyone any thought?


Oh yes, and I used the translate to LUA feature. The resulting line of code looks correct to me as well. All criteria within brackets are linked by ANDs, so therefore there ought not be any execution of the statements that are sequential to THEN until all is met, isn't it?


if (
 ( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "06:12")  and  tonumber(fibaro:getValue(156, "value")) < 7 )




thank you for any insights



Please login or register to see this attachment.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0


You need to create a custom variable that is controlled by the red time block.
For example, "Light" which can be "on" or "off"
Create a scene that sets "Light" to "on".
Create a scene that sets "Light" to "off".
Then insert the variable "Light" instead of the red block in the scene image.
Remember to uncheck "Light" in the criteria.  :)

Link to comment
Share on other sites

  • 0

Just unselect variable eyelux as trigger for starting your scene. You'll find this trigger selecting above the blocks. After that, your scene will run at 6.12 checking if eyelux is below 7 and if so execute otherwise cancel....


hope this helps

Link to comment
Share on other sites

  • 0
  • Inquirer
  • thanks guys. Indeed it was about uncheck the criteria box. See that it could come in handy, to enable multiple triggers to the same script. But in effect it does then override the AND as stated in the script blocks themselves. Oh well, one will get used to it i guess.


    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    • Create New...