Blockly examples
Moderator: leecollings
- CopyCatz
- Developer
- Posts: 123
- Joined: Thursday 11 July 2013 17:28
- Target OS: -
- Domoticz version:
- Location: Outer Heaven
- Contact:
Re: Blockly examples
nested if do was in one of the initital versions but was removed because of complexity issues. else if is in one of the recent releases, keep an eye on http://domoticz.com/wiki/Events for the announcements.
-
- Posts: 28
- Joined: Saturday 13 July 2013 9:36
- Target OS: -
- Domoticz version:
- Location: Harderwijk
- Contact:
home ventilation system
This is my working Blocky Event for my home ventilation system, level 1, 2, 3 and off.
Level 1 is dependent on bathroom or living room humidity.
Level 2 and 3 is dependent on bathroom humidity only.
Off only is only used when bathroom and living room humidity are below a set value.
I did not want the events to repeat over and over again. The value can maintain for hours and during this time the event is should normally be repeating every minute or so, that is why the event checks the current state of the switches. It only switches when the switches are in other state then the event puts them in.
I also wanted to have a manual button to set the ventilation manual on. I solved that by adding a virtual switch, that is not switching a real switch in the home. The setting of this switch is also checked in the event for level 1. Level 2 and 3 will set this switch to off. The manual 'on' setting will be reset if the humidity in the bathroom kicks the events for level 2 or 3.
Ventilation Off:

Level 1:

Level 2:

Level 3:

Result:
Most of the time, the ventilation is running on Level 1. During periods of dry weather, the ventilation stops completely.
When taking a shower, the ventilation is going to run on level 2, when taking a longer shower it even goes to level 3.
After a long shower it takes a while, then it goes back to level 2, then level 1.
I connected the home ventilation system with the 'klik-aan-klik-uit' switch type: ACM-3500-3 in front of the Perilex connector.
My ventilation system does not have a problem when level 1, 2 and 3 are powered up at the same time (or other variations) although it is designed to get power on wire 1, 1 and 2 or 1 and 3.
I have an Itho ECO-FAN CVE HP Perilex
Electrical scheme:

Because of warranty, I did not want to cut of the Perilex connector. But if you are able to do that, you also can use the switch instead of the perilex connector and plug. Then connect the wires from the fan directly to the switch.
In a normal situation, with a manual switch somewhere in your home, L1 will always be powered. You cannot shutdown the fan completely with this switch.
You can also choose to use a single switch within domoticz, to just add power to L2 (or L3) automatically. The fan is always running on level 1 and only when showering it switches to level 2 or level 3.
Makes it less complex when you don't want to shutdown the fan completely.
Electrical scheme for single switch, like KAKU ACM-1000:

(I did not test this one, but see no reasons why it should not work)
Level 1 is dependent on bathroom or living room humidity.
Level 2 and 3 is dependent on bathroom humidity only.
Off only is only used when bathroom and living room humidity are below a set value.
I did not want the events to repeat over and over again. The value can maintain for hours and during this time the event is should normally be repeating every minute or so, that is why the event checks the current state of the switches. It only switches when the switches are in other state then the event puts them in.
I also wanted to have a manual button to set the ventilation manual on. I solved that by adding a virtual switch, that is not switching a real switch in the home. The setting of this switch is also checked in the event for level 1. Level 2 and 3 will set this switch to off. The manual 'on' setting will be reset if the humidity in the bathroom kicks the events for level 2 or 3.
Ventilation Off:

Level 1:

Level 2:

Level 3:

Result:
Most of the time, the ventilation is running on Level 1. During periods of dry weather, the ventilation stops completely.
When taking a shower, the ventilation is going to run on level 2, when taking a longer shower it even goes to level 3.
After a long shower it takes a while, then it goes back to level 2, then level 1.
I connected the home ventilation system with the 'klik-aan-klik-uit' switch type: ACM-3500-3 in front of the Perilex connector.
My ventilation system does not have a problem when level 1, 2 and 3 are powered up at the same time (or other variations) although it is designed to get power on wire 1, 1 and 2 or 1 and 3.
I have an Itho ECO-FAN CVE HP Perilex
Electrical scheme:

Because of warranty, I did not want to cut of the Perilex connector. But if you are able to do that, you also can use the switch instead of the perilex connector and plug. Then connect the wires from the fan directly to the switch.
In a normal situation, with a manual switch somewhere in your home, L1 will always be powered. You cannot shutdown the fan completely with this switch.
You can also choose to use a single switch within domoticz, to just add power to L2 (or L3) automatically. The fan is always running on level 1 and only when showering it switches to level 2 or level 3.
Makes it less complex when you don't want to shutdown the fan completely.
Electrical scheme for single switch, like KAKU ACM-1000:

(I did not test this one, but see no reasons why it should not work)
Last edited by macaidwin on Friday 09 August 2013 11:20, edited 9 times in total.
- CopyCatz
- Developer
- Posts: 123
- Joined: Thursday 11 July 2013 17:28
- Target OS: -
- Domoticz version:
- Location: Outer Heaven
- Contact:
Re: Blockly examples
I'm just glad I don't have to debug that one 

-
- Posts: 6
- Joined: Wednesday 07 August 2013 0:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.4834
- Contact:
Re: Events: Blockly examples
Can you post a photo how you connected everything together?macaidwin wrote: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.jackisidore wrote:Thats interesting. What if all three perilex control lines are powered. Would/could it damage the fan?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.
-
- Posts: 28
- Joined: Saturday 13 July 2013 9:36
- Target OS: -
- Domoticz version:
- Location: Harderwijk
- Contact:
Re: Events: Blockly examples
I have added a scheme to my postmchangsp wrote: Can you post a photo how you connected everything together?
-
- Posts: 6
- Joined: Wednesday 07 August 2013 0:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.4834
- Contact:
Re: Blockly examples
Thanks for the scheme! This explains a lot!
-
- Posts: 28
- Joined: Saturday 13 July 2013 9:36
- Target OS: -
- Domoticz version:
- Location: Harderwijk
- Contact:
Re: home ventilation system
Very impressive ! I'm not that good with electronics schematics: could you explain if it would be possible to just override the perilex switch and use a Kaku switch near the ventilation-unit (Storck), the perilex has levels 1,2,3. I[/quote]
Perilex is not a switch, it is a connector.
How is your system connected now? One cable with 5 wires on a terminal block?
What colors are they? Is there a label on the ventilation box that tells you which wire is for: level 1, 2, 3 and neutral and ground?
Perilex is not a switch, it is a connector.
How is your system connected now? One cable with 5 wires on a terminal block?
What colors are they? Is there a label on the ventilation box that tells you which wire is for: level 1, 2, 3 and neutral and ground?
-
- Posts: 7
- Joined: Monday 30 September 2013 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
The wiki states 'v1.911: Implemented: set for x minutes returns to previous state after timer'.
Does that mean that if i create an event based on motion detection (if 'detector' = on) and i tell it to 'Set GROUP on for x minutes', is doesn't turn the GROUP off if it was already ON before the motion was detected?
In practice, that does not appear to be true.
My situation is as follows. I have a group that says 'Livingroom'. That group has a timer that tells the lights to go on some time before sunrise and to go off at 23:15. So far so good. Now i want to accomplish that the lights do not go off if i am still present in my livingroom, watching a movie that runs till after 23:15 for example. I assume that my presence is detected by the motion sensor, for arguments sake.
How should i accomplish that? I tried to 'blocky' an event that states that is detection is on and the group is on, it needs to turn the lights on for 60 minutes. What happens is that the lights turn off after 60 minutes after the first time the motion sensor has detected motion.
Any tips on accomplishing my goal?
Does that mean that if i create an event based on motion detection (if 'detector' = on) and i tell it to 'Set GROUP on for x minutes', is doesn't turn the GROUP off if it was already ON before the motion was detected?
In practice, that does not appear to be true.
My situation is as follows. I have a group that says 'Livingroom'. That group has a timer that tells the lights to go on some time before sunrise and to go off at 23:15. So far so good. Now i want to accomplish that the lights do not go off if i am still present in my livingroom, watching a movie that runs till after 23:15 for example. I assume that my presence is detected by the motion sensor, for arguments sake.
How should i accomplish that? I tried to 'blocky' an event that states that is detection is on and the group is on, it needs to turn the lights on for 60 minutes. What happens is that the lights turn off after 60 minutes after the first time the motion sensor has detected motion.
Any tips on accomplishing my goal?
Domoticz on Raspberry Pi2 with a RazBerry (V1.0), RFXcom USB, Greenwave (NUON) smart plug 6 & single smart plugs, Fibaro door/window sensors, Cresta temp sensors (433mhz), Z-wave.me wall controller/switch, Z-wave.me dimmer, KaKu ACM3500 etc
-
- Posts: 7
- Joined: Monday 30 September 2013 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
@piotr I will experiment with vitual switches. I'll try to update this post if i've fixed it 

Domoticz on Raspberry Pi2 with a RazBerry (V1.0), RFXcom USB, Greenwave (NUON) smart plug 6 & single smart plugs, Fibaro door/window sensors, Cresta temp sensors (433mhz), Z-wave.me wall controller/switch, Z-wave.me dimmer, KaKu ACM3500 etc
-
- Posts: 1
- Joined: Friday 18 October 2013 17:45
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
My first created blocky scenario of last week (just after I got Domoticz running on my Raspberry), a regular routine test to check the flexibility of the Domoticz system. I must admit that I never got a positive result that quick.
The use case is to switch on a few lights at 6:00 on workdays and leave then on until 30 minutes after sun-rise. But off course the "on event' should not be activated if the sun is already up.
I solved this with one blocky event and a normal ''after sun-rise" event. The only issue I have with blocky is that I could perform a for a "sun-rise" check, but not for a "30 minute after sun-rise" check.
The use case is to switch on a few lights at 6:00 on workdays and leave then on until 30 minutes after sun-rise. But off course the "on event' should not be activated if the sun is already up.
I solved this with one blocky event and a normal ''after sun-rise" event. The only issue I have with blocky is that I could perform a for a "sun-rise" check, but not for a "30 minute after sun-rise" check.
- Attachments
-
- blocky_1.jpg (22.08 KiB) Viewed 27243 times
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Blockly examples
Just a simple one...[ my first, and still not working
]
I do something wrong.... When Led 1 is on, after the set time, turning off.
Between sunset and sunrise...


I do something wrong.... When Led 1 is on, after the set time, turning off.
Between sunset and sunrise...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 5
- Joined: Sunday 22 September 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.1
- Location: Malmö, SWEDEN
- Contact:
Re: Blockly examples
Hi,
I think you have got the logic wrong.
Your picture shows:
If Led 1 = ON = 1 = sunset and sunrise
you need to add some more things like:
IF Led 1 = ON AND ........
Look at these examples to see how they done.
http://www.domoticz.com/forum/viewtopic ... &t=31#p146
http://www.domoticz.com/forum/viewtopic ... &t=31#p246
I think you have got the logic wrong.
Your picture shows:
If Led 1 = ON = 1 = sunset and sunrise
you need to add some more things like:
IF Led 1 = ON AND ........
Look at these examples to see how they done.
http://www.domoticz.com/forum/viewtopic ... &t=31#p146
http://www.domoticz.com/forum/viewtopic ... &t=31#p246
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Blockly examples
@ Paul
Thanks for your comment,
It's true that I'm missing something.
In the examples I see nothing as I want it.
I like that the LED goes out after a certain operating time.
And still i can not.
he is actually quite simple.
If the LED is on, he must after 10 minutes going to out.
And this always.
Then I move on.
Thanks for your comment,
It's true that I'm missing something.
In the examples I see nothing as I want it.
I like that the LED goes out after a certain operating time.
And still i can not.
he is actually quite simple.
If the LED is on, he must after 10 minutes going to out.
And this always.
Then I move on.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 5
- Joined: Sunday 22 September 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.1
- Location: Malmö, SWEDEN
- Contact:
Re: Blockly examples
@Derik
Here is a simple example that turn out the lights after 5 min if its turned on.
Mabye this will help you.
Here is a simple example that turn out the lights after 5 min if its turned on.
Mabye this will help you.
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Blockly examples
Hello,
A problem, for me..
Juist work with the latest beta. An it is not working.
edit: 8-11-2013
Please.
Has anyone might be time to help me.
This setup does not work.
I think I'm really wrong.
but this simple scene, I am not get it working
I search and try also a scene where I send a off signal between certain times every x minutes.
I am looking me crazy, but he does not ...
Edit log.
A problem, for me..
Juist work with the latest beta. An it is not working.
edit: 8-11-2013
Please.
Has anyone might be time to help me.
This setup does not work.
I think I'm really wrong.
but this simple scene, I am not get it working
I search and try also a scene where I send a off signal between certain times every x minutes.
I am looking me crazy, but he does not ...
Edit log.
Last edited by Derik on Thursday 14 November 2013 20:40, edited 1 time in total.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- bizziebis
- Posts: 182
- Joined: Saturday 19 October 2013 14:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8805
- Location: The Netherlands
- Contact:
Re: Blockly examples
I've also added a KAKU switch to my mechanical ventilation. I didn't touch the perilex plug. I opened up the unit and directly attached the wires from the KAKU to the PCB of the ventilation system.
I made some blocky events to controll it all. It can be controlled manualy by virtual switches or automatically by measuring the humidity of the bathroom.
I'va also added an option to override the current settings. In case I get tired of the fan running full speed when my girlfriend is showering after a late shift
The events can be optimised and some things can be put together. But then I have to send multiple signals to just make one switch. And that's something I'm not willing to do because the RfxCom is interfering with my digital tv (RTL5 HD and SBS6 HD). So with the current events it's reduced to sending only the needed signals.
The override event is not optimised at all. But I almost never use it so I didn't bother to change it yet
Level 1:

Level 2:

Level 3:

Override:

I made some blocky events to controll it all. It can be controlled manualy by virtual switches or automatically by measuring the humidity of the bathroom.
I'va also added an option to override the current settings. In case I get tired of the fan running full speed when my girlfriend is showering after a late shift

The events can be optimised and some things can be put together. But then I have to send multiple signals to just make one switch. And that's something I'm not willing to do because the RfxCom is interfering with my digital tv (RTL5 HD and SBS6 HD). So with the current events it's reduced to sending only the needed signals.
The override event is not optimised at all. But I almost never use it so I didn't bother to change it yet

Level 1:

Level 2:

Level 3:

Override:

-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Blockly examples
Could someone help me. Please
I would like to send a off signal to a lightswitch between sunrise and sunset.
And then make this one every x minutes.
I do not get it ...
And I've been working on tougher events ..
I would like to send a off signal to a lightswitch between sunrise and sunset.
And then make this one every x minutes.
I do not get it ...
And I've been working on tougher events ..

- Attachments
-
- ScreenShot109.jpg (161.03 KiB) Viewed 26920 times
-
- ScreenShot110.jpg (50.13 KiB) Viewed 26920 times
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- CopyCatz
- Developer
- Posts: 123
- Joined: Thursday 11 July 2013 17:28
- Target OS: -
- Domoticz version:
- Location: Outer Heaven
- Contact:
Re: Blockly examples
It's way simpler to set this in a schedule at the device itself. I do this every hour during the night. Your example is confusing, you would want to start with if time > sunset & time < sunrise, then switch off everything that is supposed to be off. But this will then run every minute. Running every hour or so is better for the rf traffic, and that you can do in a device schedule or lua script where you could determine elapsed time (can't do that in blockly).
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Blockly examples
Thanks @ copycats..
I really tried almost everything in blockly ...
Can you post an example of your lua script.
Or the other schedule of you to turn off, for all the switches
Because my English ....
And everything in that beautiful language ..
And unfortunately the wiki very poorly on the scripts in lua
I really tried almost everything in blockly ...


Can you post an example of your lua script.
Or the other schedule of you to turn off, for all the switches
Because my English ....
And everything in that beautiful language ..


And unfortunately the wiki very poorly on the scripts in lua
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- Arkie
- Posts: 38
- Joined: Tuesday 03 December 2013 15:24
- Target OS: NAS (Synology & others)
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Blockly examples
Hello, i made this blockly event, but it's not working between the timetable, it's working each time of the day i'll open the door!
Can somebody tell me what i'm doing wrong?
Time in Domoticz is ok
latest update 1341
greetings
Can somebody tell me what i'm doing wrong?
Time in Domoticz is ok
latest update 1341
greetings
Last edited by Arkie on Tuesday 07 January 2014 15:07, edited 1 time in total.
Synology DS412+
Philips Hue
Fibaro
Logitech Hamony elite
Foscam 9804 ip cam
RFXtrx433E USB 433.92MHz
ZXT 120 eu AC controller
Heatmiser NEO stat thermostats and Hub
Philips Hue
Fibaro
Logitech Hamony elite
Foscam 9804 ip cam
RFXtrx433E USB 433.92MHz
ZXT 120 eu AC controller
Heatmiser NEO stat thermostats and Hub
Who is online
Users browsing this forum: No registered users and 1 guest