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 )
)
then
...etc...
thank you for any insights