Blockly Events in specific days!
Posted: Thursday 04 August 2016 0:18
Hello
I want that a event wrote with blockly run just in some days of the week. It looks like very easy: an If for check day of week.... but...
I save it as device type. What I want is
if Day is not Saturday {
IF (cocina-mov = on and cocina-lux < 10) THEN cocina = ON
ELSE IF (cocina-mov = off and cocina = on) THEN light = OFF
}
cocina-mov is a PIR an cocina-lux is for metering lux. cocina is a light
I think the logic is OK, but when movement is detected and light is <10 and it's not saturday controller doesn't send any command
I think the script is correct. It Is saved as device and cocina-mov is involved so it must be triggered when cocina-mov changes, but it's not triggered when cocina-mov changes.
If a delete the checking of weekday the script works fine.
Then I made a change and wrote this blocky, also saved as device Logic now is
if (Day is not Saturday and cocina-mov has changed){
write to log cocina-mov and cocina-lux
IF (cocina-mov = on and cocina-lux < 10) THEN cocina = ON
ELSE IF (cocina-mov = off and cocina = on) THEN light = OFF
}
When I go into the room, PIR detects me and I get in log that cocina-mov is ON and cocina-lux is 0, but controller sends an OFF command instead an ON.
It Is also saved as device and cocina-mov is involved in the first IF sentence, now script is triggered but it sends the wrong command, an OFF, it evaluates to false (cocina-mov = on and cocina-lux < 10) althoug it writes in log cocina-mov is ON and cocina-lux is 0.
Why it doesn't work?
Thanks
I want that a event wrote with blockly run just in some days of the week. It looks like very easy: an If for check day of week.... but...
I save it as device type. What I want is
if Day is not Saturday {
IF (cocina-mov = on and cocina-lux < 10) THEN cocina = ON
ELSE IF (cocina-mov = off and cocina = on) THEN light = OFF
}
cocina-mov is a PIR an cocina-lux is for metering lux. cocina is a light
I think the logic is OK, but when movement is detected and light is <10 and it's not saturday controller doesn't send any command
I think the script is correct. It Is saved as device and cocina-mov is involved so it must be triggered when cocina-mov changes, but it's not triggered when cocina-mov changes.
If a delete the checking of weekday the script works fine.
Then I made a change and wrote this blocky, also saved as device Logic now is
if (Day is not Saturday and cocina-mov has changed){
write to log cocina-mov and cocina-lux
IF (cocina-mov = on and cocina-lux < 10) THEN cocina = ON
ELSE IF (cocina-mov = off and cocina = on) THEN light = OFF
}
When I go into the room, PIR detects me and I get in log that cocina-mov is ON and cocina-lux is 0, but controller sends an OFF command instead an ON.
It Is also saved as device and cocina-mov is involved in the first IF sentence, now script is triggered but it sends the wrong command, an OFF, it evaluates to false (cocina-mov = on and cocina-lux < 10) althoug it writes in log cocina-mov is ON and cocina-lux is 0.
Why it doesn't work?
Thanks