Page 1 of 36

Blockly examples

Posted: Sunday 14 July 2013 13:35
by CopyCatz
Post your blockly examples here. Make a screenshot, upload to imgur or something and show it in your post for others to watch and learn.

Re: SCRIPS - EVENT MANAGEMENT SAMPLE

Posted: Sunday 14 July 2013 20:13
by Jochen
Turn on a Light when open a door
This example will turn on a light when
1. A door is opening
2. It is between 22:00 and 07:00
A notification will be send everytime the is opening (00:00 - 24:00)
dooropenlighton.PNG
dooropenlighton.PNG (13.43 KiB) Viewed 83253 times
PS: The device Garagentor is the door (Garagentor = Garagedoor), the light is light is Licht Garage (Light Garage)

home ventilation system

Posted: Monday 15 July 2013 13:56
by macaidwin
I made these 4 events for a home ventilation system. I used a kaku ACM-3500-3 switch to power a itho eco fan with perilex connector.
Image

Edit: This example has been evolved to a more complex situation, for various reasons. See: http://www.domoticz.com/forum/viewtopic ... t=20#p1118

Re: Events: Blockly examples

Posted: Monday 15 July 2013 17:41
by capman
I made this event to switch my blinds with KAKU ASUN-650. They go down when the outside temperature is higher then the inside temperature of the livingroom , and this between 10 am and 6 pm.

Re: Events: Blockly examples

Posted: Monday 15 July 2013 21:46
by pierre4fun
A test:

Re: Events: Blockly examples

Posted: Monday 15 July 2013 21:51
by jackisidore
macaidwin wrote:I made these 4 events for a home ventilation system. I used a kaku ACM-3500-3 switch to power a itho eco fan with perilex connector.
Thats interesting. What if all three perilex control lines are powered. Would/could it damage the fan?

Re: Events: Blockly examples

Posted: Monday 15 July 2013 22:40
by bistoury
My first heating scenario.
I am afraid I will need to dig into LUA...
blocky_heating_19.jpg
blocky_heating_19.jpg (74.12 KiB) Viewed 83214 times

Re: Events: Blockly examples

Posted: Monday 15 July 2013 23:24
by willie-p
This is my try:

Re: Events: Blockly examples

Posted: Monday 15 July 2013 23:39
by macaidwin
jackisidore wrote:
macaidwin wrote:I made these 4 events for a home ventilation system. I used a kaku ACM-3500-3 switch to power a itho eco fan with perilex connector.
Thats interesting. What if all three perilex control lines are powered. Would/could it damage the fan?
In my case, that is no problem. Normally you would power 1 or 1 and 2 or 1 and 3. 1 and 2 and 3 is no problem. I did not yet try only 2 and 3.

Re: Events: Blockly examples

Posted: Monday 15 July 2013 23:41
by macaidwin
bistoury wrote:My first heating scenario.
I am afraid I will need to dig into LUA...
blocky_heating_19.jpg
Is this working? In my opinion you can't start with 'and' directly after If.
'and' has to be between two options.

Re: Events: Blockly examples

Posted: Monday 15 July 2013 23:57
by bistoury
yep, this works.

The only thing that was wrong was the temp condition (xxx = 17 instead of xxx <= 17).

In fact this condition do not start with a 'AND'. It is a standard condition "xxx AND xxx", but I display the statement using 'external input' (right-click on the green and statement).

I find it more readable : I have a temperature condition, then a scene condition (am I already heating @ 19° ?), and then I have my day and time conditions.

As for the moment I have no heating needs :) this script went to the trash

Hope this help.
Next time, I will try LUA scripting.

Re: Events: Blockly examples

Posted: Tuesday 16 July 2013 0:09
by macaidwin
bistoury wrote:yep, this works.

The only thing that was wrong was the temp condition (xxx = 17 instead of xxx <= 17).

In fact this condition do not start with a 'AND'. It is a standard condition "xxx AND xxx", but I display the statement using 'external input' (right-click on the green and statement).

I find it more readable : I have a temperature condition, then a scene condition (am I already heating @ 19° ?), and then I have my day and time conditions.

As for the moment I have no heating needs :) this script went to the trash

Hope this help.
Next time, I will try LUA scripting.
Nice! Learned something new... thanks

Re: Events: Blockly examples

Posted: Tuesday 16 July 2013 1:04
by CopyCatz
bistoury wrote:yep, this works..
Nice to see that a different notation also works :) Actually there is a lot more room for conditions if you work this way.

Re: Events: Blockly examples

Posted: Tuesday 16 July 2013 7:49
by bistoury
I thing next step should be having an ELSE statement.
I know multiple IF is not your 1st target, but the ELSE one is a must have.

have a nice day,

bistoury.

Re: SCRIPS - EVENT MANAGEMENT SAMPLE

Posted: Wednesday 24 July 2013 13:31
by gertjuhh
Jochen wrote:
dooropenlighton.PNG
How did you get that second "if-do" blocked nested?
Thats exactly what i need, but I seem unable to do so... (tested in Firefox 22.0 & Chrome 28.0.1500.72)

Re: Blockly examples

Posted: Wednesday 24 July 2013 13:35
by CopyCatz
Currently only one if..do block is supported, that screen is from an older test version.

Re: Blockly examples

Posted: Wednesday 24 July 2013 13:43
by gertjuhh
Is it going to be re-implemented?
That way the same logic doesn't need to be applied to multiple events.

Re: Blockly examples

Posted: Wednesday 24 July 2013 13:57
by CopyCatz
It isn't. The idea is that the blockly interface is for users with little experience, who want simple events in the form of a single if..do that are stored individually. For more complex events use lua scripting, there you can implement any logic you want.

Re: Blockly examples

Posted: Friday 02 August 2013 15:05
by Dynamic
I made this event to turn on the lights when there is movement outside the bedroom-doors (for example: someone comes out of his bedroom and is on his way to the bathroom or the stairs). In that case the lights are turned on at 100% (if it's before midnight) or at 20% if it's after midnight.

Need to test it tonigt... I'm not sure if the 'set overloop = level 20 % for 1 minute' will work.

Re: Blockly examples

Posted: Sunday 04 August 2013 9:57
by gibbiem
Hi, I have a question about the first and last post on this thread.

On the first, the person posted an example of a blocky where there is an 'if,do' command within and an 'if,do' command. How do you get Domoticz to create this?

On the last post, the example include an 'else,if' command, I also cant find this on my system.

Just updates to .918

Thanks