Blockly examples

Must be cleaned all topics go to the right subforum
mrmmc
Posts: 4
Joined: Saturday 22 April 2017 16:53
Target OS: Linux
Domoticz version: 3.7450
Location: finland
Contact:

Re: Blockly examples

Post by mrmmc » Tuesday 30 May 2017 17:19

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
Attachments
mh1fanoff.tiff
mh1fanoff.tiff (33.99 KiB) Viewed 1149 times

poudenes
Posts: 215
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.7392
Location: Amsterdam
Contact:

Re: Blockly examples

Post by poudenes » Monday 26 June 2017 9:30

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.42.jpg (272.31 KiB) Viewed 1003 times
Screen Shot 2017-06-25 at 13.35.34.jpg
Screen Shot 2017-06-25 at 13.35.34.jpg (80.65 KiB) Viewed 1003 times
Screen Shot 2017-06-25 at 13.35.23.jpg
Screen Shot 2017-06-25 at 13.35.23.jpg (173.67 KiB) Viewed 1003 times
Raspberry Pi3 - OSMC - Domoticz - Dashticz - MiPow PlayBulb - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

poudenes
Posts: 215
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.7392
Location: Amsterdam
Contact:

Re: Blockly examples

Post by poudenes » Monday 26 June 2017 9:31

Here last 3 ones :)
Screen Shot 2017-06-25 at 13.38.13.jpg
Screen Shot 2017-06-25 at 13.38.13.jpg (307.18 KiB) Viewed 1003 times
Screen Shot 2017-06-25 at 13.36.03.jpg
Screen Shot 2017-06-25 at 13.36.03.jpg (139.72 KiB) Viewed 1003 times
Screen Shot 2017-06-25 at 13.35.52.jpg
Screen Shot 2017-06-25 at 13.35.52.jpg (361.69 KiB) Viewed 1003 times
Raspberry Pi3 - OSMC - Domoticz - Dashticz - MiPow PlayBulb - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

dizzyweb
Posts: 9
Joined: Tuesday 20 June 2017 13:46
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by dizzyweb » Thursday 06 July 2017 8:18

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 927 times
So, can it be done in blockly? Or should I really brush up my LUA knowledge?

four2six
Posts: 65
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six » Thursday 06 July 2017 9:52

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?

dizzyweb
Posts: 9
Joined: Tuesday 20 June 2017 13:46
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by dizzyweb » Thursday 06 July 2017 13:07

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.

four2six
Posts: 65
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six » Thursday 06 July 2017 13:40

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.

four2six
Posts: 65
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six » Thursday 06 July 2017 14:14

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

dizzyweb
Posts: 9
Joined: Tuesday 20 June 2017 13:46
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by dizzyweb » Thursday 06 July 2017 14:33

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...

four2six
Posts: 65
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six » Thursday 06 July 2017 14:42

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.

dizzyweb
Posts: 9
Joined: Tuesday 20 June 2017 13:46
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by dizzyweb » Thursday 06 July 2017 15:33

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

four2six
Posts: 65
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six » Thursday 06 July 2017 15:56

name it HallwayArmed ;)

dizzyweb
Posts: 9
Joined: Tuesday 20 June 2017 13:46
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by dizzyweb » Friday 07 July 2017 8:18

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.

nixalsschrott
Posts: 7
Joined: Tuesday 11 July 2017 10:26
Target OS: NAS (Synology & others)
Domoticz version: 3.8005
Location: Germany
Contact:

Re: Blockly examples

Post by nixalsschrott » Friday 14 July 2017 12:00

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

nixalsschrott
Posts: 7
Joined: Tuesday 11 July 2017 10:26
Target OS: NAS (Synology & others)
Domoticz version: 3.8005
Location: Germany
Contact:

Re: Blockly examples

Post by nixalsschrott » Friday 14 July 2017 12:08

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

User avatar
sisaenkov
Posts: 66
Joined: Friday 27 May 2016 7:21
Target OS: Raspberry Pi
Domoticz version: 3.8
Location: Moscow, Russia
Contact:

Re: Blockly examples

Post by sisaenkov » Friday 21 July 2017 10:01

Hello.

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

four2six
Posts: 65
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six » Friday 21 July 2017 18:08

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?

User avatar
sisaenkov
Posts: 66
Joined: Friday 27 May 2016 7:21
Target OS: Raspberry Pi
Domoticz version: 3.8
Location: Moscow, Russia
Contact:

Re: Blockly examples

Post by sisaenkov » Sunday 23 July 2017 18:02

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

four2six
Posts: 65
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six » Sunday 23 July 2017 18:26

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.

maomanna
Posts: 95
Joined: Monday 30 November 2015 17:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by maomanna » Wednesday 02 August 2017 22:26

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?

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests