Blocky script doesn't work like expected...
Moderator: leecollings
-
- Posts: 12
- Joined: Thursday 24 November 2016 23:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.11506
- Location: Germany
- Contact:
Blocky script doesn't work like expected...
Hi all,
I have created a blocky script to activate spots when movement is detected. I use a Fibaro Dimmer 2 for activating the spots; the sensor is a AeonLabs Multisensor 6. My blocky script looks like this:
When the sensor detects movement, lights are switched on. Yay, so far so good. However, the time period of 30 seconds is never reached, as the lights switch of after about 10 - 11 seconds. Something is interfering with the script. However, I don't know what. I have checked the parameters of both the sensor and the dimmer, but can't seem to find the culprit what is causing this. Any suggestions ? I might have looked over some settings, but I'm running in circles here.
cheers,
Andy
I have created a blocky script to activate spots when movement is detected. I use a Fibaro Dimmer 2 for activating the spots; the sensor is a AeonLabs Multisensor 6. My blocky script looks like this:
When the sensor detects movement, lights are switched on. Yay, so far so good. However, the time period of 30 seconds is never reached, as the lights switch of after about 10 - 11 seconds. Something is interfering with the script. However, I don't know what. I have checked the parameters of both the sensor and the dimmer, but can't seem to find the culprit what is causing this. Any suggestions ? I might have looked over some settings, but I'm running in circles here.
cheers,
Andy
-
- Posts: 12
- Joined: Thursday 24 November 2016 23:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.11506
- Location: Germany
- Contact:
Re: Blocky script doesn't work like expected...
Sorry to bump this, but does anybody have a clue what may cause the above issue ?
cheers,
Andy
cheers,
Andy
- K3rryBlue
- Posts: 77
- Joined: Tuesday 07 February 2017 22:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10xx
- Location: Netherlands
- Contact:
Re: Blocky script doesn't work like expected...
- possible that the dimmer is part of a different script, with different conditions?
- if you increase after time, does the dimmer stay on longer?
- if you increase after time, does the dimmer stay on longer?
Domoticz V4.10717, RPi2 -> Linux raspberrypi 4.4.47-v7+ , RFXCOM - RFXtrx433 USB 433.92MHz ,RAZBERRY2 and OpenZWave USB Version: 1.4-2363-g1f10253-dirty
-
- Posts: 20
- Joined: Thursday 29 December 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blocky script doesn't work like expected...
Domoticz blocky 'else if' handling is broken. Nothing should be run after a condition has been true. AFAIK it's been broken since day one...
- K3rryBlue
- Posts: 77
- Joined: Tuesday 07 February 2017 22:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10xx
- Location: Netherlands
- Contact:
Re: Blocky script doesn't work like expected...
Blockly runs every 30 seconds. You need to build a condition, like cust var, to avoid a blockly will execute again. If what you're thinking is true every blockly would only execute once, which is not the case.
Domoticz V4.10717, RPi2 -> Linux raspberrypi 4.4.47-v7+ , RFXCOM - RFXtrx433 USB 433.92MHz ,RAZBERRY2 and OpenZWave USB Version: 1.4-2363-g1f10253-dirty
-
- Posts: 20
- Joined: Thursday 29 December 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blocky script doesn't work like expected...
Not sure if this was adressed to me but if so I'm talking about the fact that in an if-else if statement the "else if" statement is run even if the if statement before was true and that is by any standard computer language implementation purely wrong. Even if you do a test on googles own blocky site it works as it should https://developers.google.com/blockly/K3rryBlue wrote:Blockly runs every 30 seconds. You need to build a condition, like cust var, to avoid a blockly will execute again. If what you're thinking is true every blockly would only execute once, which is not the case.
However Domoticz has it's own wrong implementation of Blocky in this case.
- StanHD
- Posts: 347
- Joined: Friday 12 July 2013 16:09
- Target OS: Windows
- Domoticz version:
- Location: East Sussex, UK
- Contact:
Re: RE: Re: Blocky script doesn't work like expected...
And yet so many of us are using Blockley successfully since day one. Different .... maybe, unusual ..... possibly, broken .... no, because it does work.Spitfire wrote:Domoticz blocky 'else if' handling is broken. Nothing should be run after a condition has been true. AFAIK it's been broken since day one...
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
- PeGe
- Posts: 25
- Joined: Tuesday 31 January 2017 14:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.6328
- Location: Sollentuna, Sweden
- Contact:
Re: Blocky script doesn't work like expected...
I don't buy that! - When a command/instruction as essential as the "else if" statement does not work as it should according to all accepted programming standards, that script interpreter is most definitely broken. Period!
The fact that a piece of software *can* still be used to a limited extent, although being severely crippled, does not justify the obvious lack of interrest in correcting such indisputable bugs.
/P-G
The fact that a piece of software *can* still be used to a limited extent, although being severely crippled, does not justify the obvious lack of interrest in correcting such indisputable bugs.
/P-G
- StanHD
- Posts: 347
- Joined: Friday 12 July 2013 16:09
- Target OS: Windows
- Domoticz version:
- Location: East Sussex, UK
- Contact:
Re: RE: Re: Blocky script doesn't work like expected...
Please do not criticise the hard work of the developers in this way. Be constructive.PeGe wrote:I don't buy that! - When a command/instruction as essential as the "else if" statement does not work as it should according to all accepted programming standards, that script interpreter is most definitely broken. Period!
The fact that a piece of software *can* still be used to a limited extent, although being severely crippled, does not justify the obvious lack of interrest in correcting such indisputable bugs.
/P-G
How about you "Fix" Blockley yourself because Domoticz is Open Source?
I have 30+ Blockley scripts working great. (Some reasonably complex).
I am not a software coder / developer, therefore I happily accept the hard work of others, even where there are some limitations.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
-
- Posts: 20
- Joined: Thursday 29 December 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: RE: Re: Blocky script doesn't work like expected...
It's broken...period. I do not criticize the programmers (they really do a great job) I just tell that this single functionality is broken.StanHD wrote:And yet so many of us are using Blockley successfully since day one. Different .... maybe, unusual ..... possibly, broken .... no, because it does work.Spitfire wrote:Domoticz blocky 'else if' handling is broken. Nothing should be run after a condition has been true. AFAIK it's been broken since day one...
- K3rryBlue
- Posts: 77
- Joined: Tuesday 07 February 2017 22:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10xx
- Location: Netherlands
- Contact:
Re: Blocky script doesn't work like expected...
Hi Spitfire, do you have an example that shows what you're trying to tell.
Sofar I haven't had any issues with blocky inside domoticz, beside a missing "else".
However I do admit that I've added custom vars, to exclude accessing the else-if.
But this is mostly done because there is no ELSE possible.
Sofar I haven't had any issues with blocky inside domoticz, beside a missing "else".
However I do admit that I've added custom vars, to exclude accessing the else-if.
But this is mostly done because there is no ELSE possible.
Domoticz V4.10717, RPi2 -> Linux raspberrypi 4.4.47-v7+ , RFXCOM - RFXtrx433 USB 433.92MHz ,RAZBERRY2 and OpenZWave USB Version: 1.4-2363-g1f10253-dirty
Re: Blocky script doesn't work like expected...
Could it that this Blockly is used as 'Time' instead of 'Device'? Whenever it runs and the status of the sensor is Off, it would start counting over and over again. I don't use Blockly myself anymore after learning some LUA and it looks to me that it uses the stat of 'otherdevices' instead of 'devicechanged'. (I hope,this makes sense )
-
- Posts: 331
- Joined: Wednesday 21 December 2016 9:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: current
- Contact:
Re: Blocky script doesn't work like expected...
Just to add that I do recognise this problem, and that I agree with Spitfire here.
I've created a blockly where the light would automatically turn on between sunset and 22:00, but only if I'm at home (using mobile phone presence detection script).
It's been behaving weirdly since day one, and I just couldn't understand why. I've tried to disable other Blocklies, etc.
Perhaps this is the cause.
I only use Blockly. And I really like that Domoticz even has Blocky, I think it's a unique selling point!
I've created a blockly where the light would automatically turn on between sunset and 22:00, but only if I'm at home (using mobile phone presence detection script).
It's been behaving weirdly since day one, and I just couldn't understand why. I've tried to disable other Blocklies, etc.
Perhaps this is the cause.
I only use Blockly. And I really like that Domoticz even has Blocky, I think it's a unique selling point!
-
- Posts: 20
- Joined: Thursday 29 December 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blocky script doesn't work like expected...
If you take the thread starting example above and change it so "SensorHal1 = On" on BOTH the "if" and "else if" (stupid example but anyway) the following would happen:K3rryBlue wrote:Hi Spitfire, do you have an example that shows what you're trying to tell.
Sofar I haven't had any issues with blocky inside domoticz, beside a missing "else".
However I do admit that I've added custom vars, to exclude accessing the else-if.
But this is mostly done because there is no ELSE possible.
Leveldimmer2_2 would be set to 40%
AND (this is not in practice in ANY prog language AFAIK, only the first one should be run!)
Leveldimmer2_2 would be set to Off after 30 seconds
As mentioned this is a stupid exampel since I would say that it's also a bug (from the one who wrote the script) if you have the EXACT same "if" as "else if" case BUT if you had added som other constraints to one of the cases like "daylight = on" you would still run both the "if" and the "else if" Do parts. Domticz "else if" handling is more like "or if"...
Don't know if my explanation was clear enough but it's what you get...
- K3rryBlue
- Posts: 77
- Joined: Tuesday 07 February 2017 22:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10xx
- Location: Netherlands
- Contact:
Re: Blocky script doesn't work like expected...
Hi Spitfire,
Now I got it. This explanation is clear enough.
And damn you are right, I think either the name "ELSE IF" , or the interpreter is wrong.
The IF.... ELSE IF acts as 2 separate IF statements (nested IF).
If the IF statement is reached it should never reach the ELSE branch.
Now I got it. This explanation is clear enough.
And damn you are right, I think either the name "ELSE IF" , or the interpreter is wrong.
The IF.... ELSE IF acts as 2 separate IF statements (nested IF).
If the IF statement is reached it should never reach the ELSE branch.
Domoticz V4.10717, RPi2 -> Linux raspberrypi 4.4.47-v7+ , RFXCOM - RFXtrx433 USB 433.92MHz ,RAZBERRY2 and OpenZWave USB Version: 1.4-2363-g1f10253-dirty
-
- Posts: 20
- Joined: Thursday 29 December 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blocky script doesn't work like expected...
Yes, spot on!K3rryBlue wrote:Hi Spitfire,
Now I got it. This explanation is clear enough.
And damn you are right, I think either the name "ELSE IF" , or the interpreter is wrong.
The IF.... ELSE IF acts as 2 separate IF statements (nested IF).
If the IF statement is reached it should never reach the ELSE branch.
-
- Posts: 139
- Joined: Tuesday 06 September 2016 20:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: L stab
- Location: Belgium
- Contact:
Re: Blocky script doesn't work like expected...
Hi,
I have also a strange behavior with a nested if else-if
The 2 write to log are always executed.
Is this normal or have I done soemthing wrong?
Kind regards
Koen
I have also a strange behavior with a nested if else-if
The 2 write to log are always executed.
Is this normal or have I done soemthing wrong?
Kind regards
Koen
Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12. RFXtrx433E, 16x AMST-606, 5 Somfy RTS motors
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
- K3rryBlue
- Posts: 77
- Joined: Tuesday 07 February 2017 22:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10xx
- Location: Netherlands
- Contact:
Re: Blocky script doesn't work like expected...
Seems that the structure is correct. Both conditions if vakanie=off and else if vakanie=on are different, it should never execute both. In either case if one is true the other is always wrong. Unless "on/off" is not valid for this switch.
Domoticz V4.10717, RPi2 -> Linux raspberrypi 4.4.47-v7+ , RFXCOM - RFXtrx433 USB 433.92MHz ,RAZBERRY2 and OpenZWave USB Version: 1.4-2363-g1f10253-dirty
-
- Posts: 102
- Joined: Thursday 28 January 2016 22:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8153
- Location: NL
- Contact:
Re: Blocky script doesn't work like expected...
The Aeon Multisensor 6 default config sends an ON when motion is detected and will send an OFF, 240 seconds after that.
This value of 240 secs is configurable. But configuring it is a bit of a hassle, because the sleep mode of the sensor. But it can be done.
I'd change this value to 30 secs, and associate this switch directly to the Figaro, in the zwave configuration. But if you really need it to go at 40%, create two blocklys, instead of direct association. One blockly for on at 40%, one blockly for off.
This value of 240 secs is configurable. But configuring it is a bit of a hassle, because the sleep mode of the sensor. But it can be done.
I'd change this value to 30 secs, and associate this switch directly to the Figaro, in the zwave configuration. But if you really need it to go at 40%, create two blocklys, instead of direct association. One blockly for on at 40%, one blockly for off.
Who is online
Users browsing this forum: No registered users and 1 guest