Help needed with this blocky

Moderator: leecollings

Post Reply
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Help needed with this blocky

Post by astrapowerrr »

I can’t get this blocky to work.
My variable sets to 1 after 330 seconds.
But after 330 second with still tapwater on and variable set to 1 my switch douche actief won’t go to on. And tapwater won’t go back to 0.

But when I switch of tapwater with the variable set to 1, the Variable will go back to 0.

The reason for this blocky is to know when I am in the shower.
And this is only when the switch tapwater is longer then 330 seconds active.
Together with some other input.

This 330 sec is needed because my tapwater keeps heated by my cv sometimes and that takes 300 sec.

I hope someone can help me here....

Image


Verzonden vanaf mijn iPhone met Tapatalk
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Help needed with this blocky

Post by Jan Jansen »

Remove Set VAR S-Z Tapwater after Set A-F Douche actief = On
mrf68

Re: Help needed with this blocky

Post by mrf68 »

IMHO this script will never reach the second statement, because if the second is true, then also the first is true and it will stop there.
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: Help needed with this blocky

Post by astrapowerrr »

@jan jansen i removed the var... but still not working?

@mrf68 can you explain.. because i looked at this blocky for ours and i realy dont see what is wrong...

as read my blocky...
when the switch tapwater is on set var to 1 after 330sec.
then when the switch tapwater is on and var is 1(so that will be after 330 seconds) set switch douche actief on and reset var back to 0

and when tapwater is off after 200 sec for example
then tapwater is off and 130 sec later var will be 1 so that means rule 3 tapwater of and var 1 means switch douche actief off and reset var back to 0

as i am typing this i just dont see what is wrong and why??
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: Help needed with this blocky

Post by felix63 »

What @mrf68 means is that the logic of you blocky works other that you expect.

if a then x
elseif a and b then y
elseif not a and b then z

means that if a is true x will be executed and the remainder of the if statement will not be evaluated. The test 'a and b' will be never evaluated. So you could change the statement to

if a and b then x
elseif a then y
elseif not a and b then z
mrf68

Re: Help needed with this blocky

Post by mrf68 »

Just imagine what happens:

Tapwater is on, blockly starts:

“ if tapwater is on then do something “

Okay. Then there is an else/if. That will not be executed, because there is no need for an else. The first statement is
TRUE, so that’s it. You could add a check to the first statement: .... and var tapwater <> 1

Overall people try to put as many things in one blockly and then experience some problems with it. Start with one statement and test it. In this case make 3 different blocklys and check the log for results.
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: Help needed with this blocky

Post by astrapowerrr »

@mrf68 will try that... thanks..

so i make 3 blockys and see what happens step by step.

edit:
i extracted it to 3 blockys.
the first works, tapwater on sets after 330 seconds the var to 1

2nd blocky i did if var=1 set "douche actief on"
here it gets tricky.

when i use the first blocky and the var gets to 1 nothing happens(douche actief stays off)
but when i manually change the var from 0 to 1 douche actief switches on???

:roll: :roll: :roll: :roll:
mrf68

Re: Help needed with this blocky

Post by mrf68 »

I don’t use blockly that much anymore, but if I remember correctly the change of the value of a variable will not trigger a blockly. You can set a variable, you can use it to compare it to something, but it will not trigger an action itself. At least, that was in the old days and I am not sure if this behaviour has changed.
Instead of using variables you could try to use dummy switches. If the value of a variable only changes from 0 to 1 or vice versa, then you can use a dummy switch for that (and set it On or Off). Try to replace the variable with a dummy switch and try again.
clinicdarman
Posts: 1
Joined: Wednesday 28 November 2018 7:31
Target OS: -
Domoticz version:
Contact:

Re: Help needed with this blocky

Post by clinicdarman »

check to the first statement
کلینیک پایتخت
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: Help needed with this blocky

Post by astrapowerrr »

mrf68 wrote:I don’t use blockly that much anymore, but if I remember correctly the change of the value of a variable will not trigger a blockly. You can set a variable, you can use it to compare it to something, but it will not trigger an action itself. At least, that was in the old days and I am not sure if this behaviour has changed.
Instead of using variables you could try to use dummy switches. If the value of a variable only changes from 0 to 1 or vice versa, then you can use a dummy switch for that (and set it On or Off). Try to replace the variable with a dummy switch and try again.

That did it!!

Image

Never knew that a variable could not switch a switch.


Verzonden vanaf mijn iPhone met Tapatalk
mrf68

Re: Help needed with this blocky

Post by mrf68 »

I’m glad it works. Maybe it is not the most elegant or efficient way, but the most important part of automation is that it works. ;)
Glad I could help.

Regards,
Martin
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest