Page 1 of 1

Blockly script not working

Posted: Wednesday 13 July 2016 22:31
by hvb83
I made a blockly script and for some reason it doesn't work, but I cannot find out what I am doing wrong:
Schermafbeelding 2016-07-13 om 22.27.28.png
Schermafbeelding 2016-07-13 om 22.27.28.png (123.71 KiB) Viewed 2164 times
The logfile states the following:
Schermafbeelding 2016-07-13 om 22.28.14.png
Schermafbeelding 2016-07-13 om 22.28.14.png (190.98 KiB) Viewed 2164 times
I'm sure for the experts it's easy to spot, but I cannot figure it out myself. :oops:

Re: Blockly script not working

Posted: Wednesday 13 July 2016 23:29
by Derik
mmm

What is badkamer... [ looks Light switch.. is that correct? ]
Time must be. xxx OR xxx

Re: Blockly script not working

Posted: Thursday 14 July 2016 8:09
by hvb83
Badkamer is indeed the bathroom light switch, which is supposed to turn the bathroom ventilation and mirror lights/heating on.

I've tried changing AND to OR, but still get the same error.

Re: Blockly script not working

Posted: Thursday 14 July 2016 8:28
by StanHD
The Badkamer is a dimmer switch? If so, just to test, try using "not = Off".

Re: Blockly script not working

Posted: Thursday 14 July 2016 9:02
by trixwood
Time must be. xxx OR xxx
time >= 6.00 or time <= 10.30
is 24 hours...

time >= 6.00 and time <= 10.30
is 4 and 1/2 hours and 1 minute (minus 1 millisecond) between (including) 6.00 and 10.30

fyi.
try using "not = Off".
Confusing... i think you mean:

If it is a switch why check >10%? and not if it's on?

e.g. if badkamer = on and time >= 6.00 and time <= 10.30

Re: Blockly script not working

Posted: Thursday 14 July 2016 11:52
by hvb83
Sorry for the confusion guys, indeed it is a dimmer and not a switch per say. On another dimmer I found that "if dimmer = on" only triggered above a certain dimmer level, like 30% or more. I therefor figured setting it to 10% would work more reliable in my situation. It's only temporary, until I've figured out why the on/off trigger doesn't work like it is supposed to.

The event is to be true between 6.00 and 10.30, so I think OR was correct.

But that still leaves it a big mystery why I get an error. :D

Re: Blockly script not working

Posted: Thursday 14 July 2016 12:59
by StanHD
The reason to test "Not = Off" (ie any level except off) is because a dimmer sometimes doesn't respond to "on" or the problem may be with the Level %. So if it works with "Not = Off" then the level % part is the problem, not the time criteria.

This works OK:-

Image

Not an answer to the problem but a possible work around?

Re: Blockly script not working

Posted: Thursday 14 July 2016 20:04
by trixwood
I got confused with NOT = Off :-) I interpreted it as 'NOT' = Off (as an identifier not as an operator in programming terms)
never excepted that and read it all wrong! Will include that in [≠, <> or !=] data set ;-)

Re: Blockly script not working

Posted: Thursday 14 July 2016 20:34
by StanHD
Sorry, my fault I didn't know how to type those characters on my tablet

Re: Blockly script not working

Posted: Saturday 16 July 2016 9:58
by hvb83
Thanks Stan, that did the trick! Now my script is changed in a minor way, but it's working: