Blockly examples

Moderator: leecollings

Post Reply
User avatar
CopyCatz
Developer
Posts: 123
Joined: Thursday 11 July 2013 17:28
Target OS: -
Domoticz version:
Location: Outer Heaven
Contact:

Blockly examples

Post 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.
User avatar
Jochen
Posts: 11
Joined: Saturday 13 July 2013 10:37
Target OS: -
Domoticz version:
Location: Germany / NRW
Contact:

Re: SCRIPS - EVENT MANAGEMENT SAMPLE

Post 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 82521 times
PS: The device Garagentor is the door (Garagentor = Garagedoor), the light is light is Licht Garage (Light Garage)
I have not failed 1,000 times.
I have successfully discovered 1000 ways to NOT make a light bulb.
*Thomas Edison*
macaidwin
Posts: 28
Joined: Saturday 13 July 2013 9:36
Target OS: -
Domoticz version:
Location: Harderwijk
Contact:

home ventilation system

Post 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
Last edited by macaidwin on Thursday 08 August 2013 16:07, edited 1 time in total.
User avatar
capman
Posts: 153
Joined: Friday 12 July 2013 20:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

Re: Events: Blockly examples

Post 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.
Attachments
Blinds01.jpg
Blinds01.jpg (78.17 KiB) Viewed 82585 times
pierre4fun
Posts: 5
Joined: Friday 12 July 2013 13:39
Target OS: -
Domoticz version:
Location: Toulon France
Contact:

Re: Events: Blockly examples

Post by pierre4fun »

A test:
Attachments
Capture1.PNG
Capture1.PNG (19.53 KiB) Viewed 82501 times
jackisidore
Posts: 19
Joined: Friday 12 July 2013 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: Events: Blockly examples

Post 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?
bistoury
Posts: 35
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: Events: Blockly examples

Post 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 82482 times
willie-p
Posts: 34
Joined: Friday 12 July 2013 14:19
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Events: Blockly examples

Post by willie-p »

This is my try:
Attachments
alarm.png
alarm.png (15.49 KiB) Viewed 82475 times
macaidwin
Posts: 28
Joined: Saturday 13 July 2013 9:36
Target OS: -
Domoticz version:
Location: Harderwijk
Contact:

Re: Events: Blockly examples

Post 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.
macaidwin
Posts: 28
Joined: Saturday 13 July 2013 9:36
Target OS: -
Domoticz version:
Location: Harderwijk
Contact:

Re: Events: Blockly examples

Post 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.
bistoury
Posts: 35
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: Events: Blockly examples

Post 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.
macaidwin
Posts: 28
Joined: Saturday 13 July 2013 9:36
Target OS: -
Domoticz version:
Location: Harderwijk
Contact:

Re: Events: Blockly examples

Post 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
User avatar
CopyCatz
Developer
Posts: 123
Joined: Thursday 11 July 2013 17:28
Target OS: -
Domoticz version:
Location: Outer Heaven
Contact:

Re: Events: Blockly examples

Post 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.
bistoury
Posts: 35
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: Events: Blockly examples

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

Re: SCRIPS - EVENT MANAGEMENT SAMPLE

Post 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)
User avatar
CopyCatz
Developer
Posts: 123
Joined: Thursday 11 July 2013 17:28
Target OS: -
Domoticz version:
Location: Outer Heaven
Contact:

Re: Blockly examples

Post by CopyCatz »

Currently only one if..do block is supported, that screen is from an older test version.
gertjuhh

Re: Blockly examples

Post by gertjuhh »

Is it going to be re-implemented?
That way the same logic doesn't need to be applied to multiple events.
User avatar
CopyCatz
Developer
Posts: 123
Joined: Thursday 11 July 2013 17:28
Target OS: -
Domoticz version:
Location: Outer Heaven
Contact:

Re: Blockly examples

Post 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.
User avatar
Dynamic
Posts: 109
Joined: Friday 12 July 2013 14:50
Target OS: -
Domoticz version:
Location: Enschede
Contact:

Re: Blockly examples

Post 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.
Attachments
event-overloop.png
event-overloop.png (31.89 KiB) Viewed 81169 times
gibbiem
Posts: 4
Joined: Saturday 13 July 2013 3:36
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests