Page 24 of 36

Re: Blockly examples

Posted: Tuesday 30 May 2017 17:19
by mrmmc
newbie here...

now i have problem, event do nothing...
and its easy block event :o

i try change 24 > 24.1 temp set point, fibaro motion sensor gives 23.7 out, fan doest go off, no log write...

fibaro motion sensor and fibaro dual relay, ubuntu

Re: Blockly examples

Posted: Monday 26 June 2017 9:30
by poudenes
So finally i have done all my blocky scripts... Check the different blocky configs. :)
Screen Shot 2017-06-25 at 13.35.42.jpg
Screen Shot 2017-06-25 at 13.35.34.jpg
Screen Shot 2017-06-25 at 13.35.23.jpg

Re: Blockly examples

Posted: Monday 26 June 2017 9:31
by poudenes
Here last 3 ones :)
Screen Shot 2017-06-25 at 13.38.13.jpg
Screen Shot 2017-06-25 at 13.36.03.jpg
Screen Shot 2017-06-25 at 13.35.52.jpg

Re: Blockly examples

Posted: Thursday 06 July 2017 8:18
by dizzyweb
Morning folks...

I'm having some issue with a blockly which does a bit more than needed. Situation is, I've got a dummy which tells if it's dark or not (IsDonker) and a dummy which tells if someone's home (SomeoneHome).

What I want to accomplish is the hallway light turning on for 5 minutes when it's dark and someone comes home. This blockly does exactly that, but it also turns the light on for 5 minutes when someone is home and it gets dark. I only want it to trigger on someone coming home in the dark, not when we're already at home. I'm starting to get the feeling I can only do that in a script since blockly triggers on all device changes.
HallwayLightsBlockly.PNG
HallwayLightsBlockly.PNG (33.89 KiB) Viewed 7837 times
So, can it be done in blockly? Or should I really brush up my LUA knowledge?

Re: Blockly examples

Posted: Thursday 06 July 2017 9:52
by four2six
I'm sure the answer is yes to both questions ;)

what's the difference between 'HallwayOn' and 'Lamp Halway'. One being a group of Lights?
edit:
and how do you know someone is coming home?

Re: Blockly examples

Posted: Thursday 06 July 2017 13:07
by dizzyweb
HallwayOn is a dummy switch to register if the light has been turned on before. Else the lights would just go off and on again after 5 minutes, since the conditions haven't changed. Lamp Hal is the fibaro switch that switches the physical lamp.

SomeoneHome is a dummy switch that is turned on when either my phone or my girlfriends phone is online on our wifi network. Using the presence detection script from the wiki.

Re: Blockly examples

Posted: Thursday 06 July 2017 13:40
by four2six
ok.

I'm not sure the Lamp Hallway switch would go on again, if you wouldn't use that HallwayOn dummy switch.

You enter the home, the SomeoneHome dummy switch changes from Off to On. That triggers the action.

Have you tried a simple

Code: Select all

If SomeoneHome = On and IsDonker = On
set LampHal = On for 5 Minutes
?

In my experience "If SomeoneHome = On" doesn't mean what it says (always check if someone is home and if so, do what is stated) but it means once the status of SomeoneHome switches to On, do what is stated. I might be wrong, but give it a try.

Of course i don't know how often SomeoneHome switches during the night for other reasons (system changes, phones go off, etc)... if that's the case you'd have to work with a dummy switch somehow.

Re: Blockly examples

Posted: Thursday 06 July 2017 14:14
by four2six
ok, i forgot this will turn on once it gets dark and someone is home. so you need a dummy switch. sorry. this was your original problem.

try

Code: Select all

If SomeoneHome = Off and IsDonker = On
Set HallwayOn = On

Else If IsDonker = Off
set HallwayOn = Off

Else If SomeoneHome = On and HallwayOn = On
set LampHal = On for 5 Minutes

Re: Blockly examples

Posted: Thursday 06 July 2017 14:33
by dizzyweb
That might tackle my current problem, but... doesn't this mean my light will never turn off again? After 5 minutes those conditions will still be true, so the light will immediately turn on again. I think I'd need yet another switch for this...

Re: Blockly examples

Posted: Thursday 06 July 2017 14:42
by four2six
i don't think this will turn the light back on. as i said above, it doesn't check both if-parts for being true, but it checks if the whole if-block turns (!) true. as long as you don't leave home and SomeoneHome is turned to off and you enter your home again and SomeoneHome turns back to On, the light shouldn't switch on. And this seems to be exactly what you want. Give it a try.

Re: Blockly examples

Posted: Thursday 06 July 2017 15:33
by dizzyweb
Hmm, you're right. I wonder why the light kept turning back on yesterday. <ight have to rename the dummy though, it's functionality isn't really matching it's use like this :P

Re: Blockly examples

Posted: Thursday 06 July 2017 15:56
by four2six
name it HallwayArmed ;)

Re: Blockly examples

Posted: Friday 07 July 2017 8:18
by dizzyweb
Well, I'll leave it as is for the moment since... it still turns the hallway lights on at sundown when we're already home. So your suggestion seems to have the exact same outcome as my own blockly :P

Thought I really don't understand why it happened yet.

Edit:
Figured it out. Had an error in the first if [SomeoneHome = On] instead of Off. But it wouldn't work if I tested it after I corrected the error... But I figure that's because the 5 minutes for the previous trigger hadn't run out. It seems you can't trigger that event again during the "for X minutes" cycle. I'll have to wait till tonight for a live test, but it appears to work.

Re: Blockly examples

Posted: Friday 14 July 2017 12:00
by nixalsschrott
Letalis wrote:... Can you get blocky to only send notification once?
kurniawan77 wrote: ... Is there some way that i can cancel the timer? ...
Do not know, if you both solved your problem already, but nevertheless wanted to share my solution with you and all new Blockly users.
If you want to stop an action, e.g. sending a message or notification, but also stopping to trigger something, e.g roller shutter getting in a defined postition, you need to include an own user variable, which needs to be defined seperately. This variable needs to be checked in the beginning (if) and needs to be changed in the end (then do change) e.g. from 0 to 1.
But do not forget to write a sepaerate Blockly to reset the user variable to 0 again. Otherwise your Blockly event will not be triggered again, since the Blockly script checks the variable in the beginning (should be 0).

Kind regards
matty

Re: Blockly examples

Posted: Friday 14 July 2017 12:08
by nixalsschrott
One more thing I wanted to share, since I found this mistake after three days of testing ... could save some time for other people.
While trying to write a Blocky script for closing and opening my roller/shutter it was not working. The event was finally triggered, I have got my notifcation message but the roller/shutter position did not change. I triggered to open or to close the roller/shutter and this was my mistake. Since my Qubino shutter switch is configured with percentage you need to use set to percentage 0 or 100. Then will wok. Therefore, always look carefully at your switches when writing some Blockly scripts.. ;-)

Kind regards

Re: Blockly examples

Posted: Friday 21 July 2017 10:01
by sisaenkov
Hello.

I've got pressure sensors like this one:
pressure.png
pressure.png (12.29 KiB) Viewed 7549 times
And I can't get such event working:
pressure2.png
pressure2.png (19.51 KiB) Viewed 7549 times
I have also tried using String field for pressure value.
Works only "not equal" type.

Re: Blockly examples

Posted: Friday 21 July 2017 18:08
by four2six
some first thoughts: why is the notification subject empty?

did you try it without the notification?

is the value of the pressure sensor above 1 and then changes to below 1? or is it below 1 all the time?

Re: Blockly examples

Posted: Sunday 23 July 2017 18:02
by sisaenkov
1. Subject is unnecessary for Telegram notifications.
2. Yes, I tried.
3. At that moment value of pressure sensor was 0.

Unfortunately blocky doesn't work correctly with pressure sensors' value.
As a result I decide to write this logic with LUA:

Code: Select all

if (otherdevices['ColdWaterAvail'] == "On" and otherdevices_svalues['CWPressureSensor'] <= "0.5") then
    commandArray['ColdWaterAvail'] = 'Off'
    print('CW Pressure is: ' ..otherdevices_svalues['CWPressureSensor'])
end

Re: Blockly examples

Posted: Sunday 23 July 2017 18:26
by four2six
blockly has a problem, if both 'and' conditions are already fulfilled. i'd guess it would work if one of them becomes true after you start the testing. LUA is definitely safer.

Re: Blockly examples

Posted: Wednesday 02 August 2017 22:26
by maomanna
I am working on my blockly alarm.

I have a BeNext tag reader, which can only be switched with tags.
The tagreader is located at the backdoor, but i'd like to use an virtual switch to manually turn on and off my alarm.

Now i have this:

Image
Image

My problem then is, that when i switch the virtual one, it is the same rule as when i turn off the benext tagreader.
i can overrule the virtual switch, but i cannot overrule the tagreader.

How can i manage this?