Blockly examples
Moderator: leecollings
- 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
'Before sunrise' should be 'before sunset', other that it should work just fine. I use it a lot like this.
- mvveelen
- Posts: 687
- Joined: Friday 31 October 2014 10:22
- Target OS: NAS (Synology & others)
- Domoticz version: Beta
- Location: Hoorn, The Netherlands
- Contact:
Re: Blockly examples
I've changed it and now it is:
15 min After Sunset: On
15 min Before Sunrise: Off
I hope this will work. I'd rather have it with Blockly, because then I can get notifications and will know if it works when I'm at work, and also I can add IF's and OR's.... So if someone could help me out with that....?
Edit: this doesn't work..... bummer...
15 min After Sunset: On
15 min Before Sunrise: Off
I hope this will work. I'd rather have it with Blockly, because then I can get notifications and will know if it works when I'm at work, and also I can add IF's and OR's.... So if someone could help me out with that....?
Edit: this doesn't work..... bummer...
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
-
- Posts: 11
- Joined: Saturday 01 February 2014 18:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Shame i would like to use it also, At sunset there is still a lot of light so i also would like to turn the light on later.mvveelen wrote:I've changed it and now it is:
15 min After Sunset: On
15 min Before Sunrise: Off
I hope this will work. I'd rather have it with Blockly, because then I can get notifications and will know if it works when I'm at work, and also I can add IF's and OR's.... So if someone could help me out with that....?
Edit: this doesn't work..... bummer...
Maby a feature request

Measuring time is also not possible in blockly i think ?
If movement is detected for longer then 5 minutes then do ...
-
- Posts: 267
- Joined: Tuesday 14 January 2014 14:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Just set the timer to turn on X minutes after sunsetErikCramer wrote: Shame i would like to use it also, At sunset there is still a lot of light so i also would like to turn the light on later.
Maby a feature request![]()
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.
- mvveelen
- Posts: 687
- Joined: Friday 31 October 2014 10:22
- Target OS: NAS (Synology & others)
- Domoticz version: Beta
- Location: Hoorn, The Netherlands
- Contact:
Re: Blockly examples
Hi, I got mine working (never mind the 12:00....at least it works like this):ErikCramer wrote:Shame i would like to use it also, At sunset there is still a lot of light so i also would like to turn the light on later.mvveelen wrote:I've changed it and now it is:
15 min After Sunset: On
15 min Before Sunrise: Off
I hope this will work. I'd rather have it with Blockly, because then I can get notifications and will know if it works when I'm at work, and also I can add IF's and OR's.... So if someone could help me out with that....?
Edit: this doesn't work..... bummer...
Maby a feature request
Measuring time is also not possible in blockly i think ?
If movement is detected for longer then 5 minutes then do ...
Sunrise

Sunset

You can change the delay (900 sec = 15 min)
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
-
- Posts: 15
- Joined: Tuesday 03 June 2014 11:23
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Holland
- Contact:
Re: Blockly examples
Just wanted to share my method for switching on things when it's a certain time before or after sunset. I use a virtual switch that is on or off which I then use to put in a blocky scheme.
This is the virtual (sun) switch which is one or off depending on the time and it moves with the shortening days.

In a blocky scheme I then check if it's on or off to turn something else on. Below on example with a movement sensor that turns on a lamp, when the virtual switch is on.

This is the virtual (sun) switch which is one or off depending on the time and it moves with the shortening days.
In a blocky scheme I then check if it's on or off to turn something else on. Below on example with a movement sensor that turns on a lamp, when the virtual switch is on.
Raspberry Pi running Domoticz image
-
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Blockly examples
I use a virtual switch in the same way. I have named it 'IsDark'. It is activated 1 minute after sunset, and deactivated 1 minute after sunrise. So it covers the dark period between sunset and sunrise.
Works great for using in events, much easier than fiddling with '>sunrise, <sunset' etc etc.
Why do you turn yours on 3h before sunset, and 2h after sunrise? Seems like quite a big timespan for the lights to be on?
I have two Blockly events that are worth sharing, but i can't access my Domoticz right now (i am at work). Will share it when i am at home.
Works great for using in events, much easier than fiddling with '>sunrise, <sunset' etc etc.
Why do you turn yours on 3h before sunset, and 2h after sunrise? Seems like quite a big timespan for the lights to be on?
I have two Blockly events that are worth sharing, but i can't access my Domoticz right now (i am at work). Will share it when i am at home.
- One event is used for turning on some light when me or my girlfriend arrives home, and it is dark (detection done by wifi ping smartphone using this script)
It contains a user variable so that the event is only triggered once, otherwise i couldn't turn the lights off by hand because the conditions of the event were still validI reset this variable when nobody is home (virtual switch 'SomeoneHome' = off) so that the script can trigger again if i go for a walk when it is dark, and still dark when i come back home.
- The other controls my heating, i use a relay connected to a GPIO pin.
When the relay closes, it connects two wires of my central heating thermostat together (my Remeha iSense (OpenTherm) thermostat has an external input for this) and the thermostat activates the dayprogram (=19 degrees). This way i turn on the heating when someone is home, and turn off heating when nobody is home. I also can flick the switch for my thermostat from a remote location, so i can arrive in a warm house. I don't need no expensive smart thermostat like the Nest
I am not active on this forum anymore.
- proohu01
- Posts: 95
- Joined: Friday 17 October 2014 12:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Blockly examples
Thank you xKingx. I was looking to do the same thing. Creating two virtual switches and then use those in the blockly is great.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
-
- Posts: 15
- Joined: Tuesday 03 June 2014 11:23
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Holland
- Contact:
Re: Blockly examples
I use the big time frame before and after sunset and sunrise because my significant other and the kids always complain it's too dark......
Raspberry Pi running Domoticz image
Re: Blockly examples
is there a way to 'event' a press at the wall-mounted switch (Klik aan klik uit WST-8800)?
When switched on or off, the 'state' remains in that state until it is switched. (deep; I know)
but imagine when it is on, and I press the on button again - I would like to use that event to step down the dimmer a few percent. - Possible? not that I expected anything from it; a 'chime' event is not working
When switched on or off, the 'state' remains in that state until it is switched. (deep; I know)
but imagine when it is on, and I press the on button again - I would like to use that event to step down the dimmer a few percent. - Possible? not that I expected anything from it; a 'chime' event is not working

-
- Posts: 7
- Joined: Wednesday 12 February 2014 15:38
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Hello.
I have made a blockly that dont work alright.
I have a motion detector that domoticz use as a sensor.
Blockly is like this.
If motion is on and time > 00:00 to < 06:00
Set staitwaylight on for 3 minutes.
It is not working on daytime as it should.
But by night when motion is detected it turn on the light,
Then of after 3 minutes, then on again after 3 minutes,
Then of again after 3 minutes, and then loop it all the night.
What is wrong?
I have made a blockly that dont work alright.
I have a motion detector that domoticz use as a sensor.
Blockly is like this.
If motion is on and time > 00:00 to < 06:00
Set staitwaylight on for 3 minutes.
It is not working on daytime as it should.
But by night when motion is detected it turn on the light,
Then of after 3 minutes, then on again after 3 minutes,
Then of again after 3 minutes, and then loop it all the night.
What is wrong?
-
- Posts: 18
- Joined: Saturday 04 January 2014 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Blockly examples
Try this
If motion is on
and time > 06:00 to < 00:00
and "staitwaylight " is off
Set staitwaylight on for 3 minutes.
If motion is on
and time > 06:00 to < 00:00
and "staitwaylight " is off
Set staitwaylight on for 3 minutes.
CubieTruck with Domoticz
RfxTrx 433Mhz Usb, Rfx Sensor, Z-Wave
Slave Raspberry Pi with Domoticz, Piface, P1 usb
RfxTrx 433Mhz Usb, Rfx Sensor, Z-Wave
Slave Raspberry Pi with Domoticz, Piface, P1 usb
-
- Posts: 7
- Joined: Wednesday 12 February 2014 15:38
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Thanks. Its woking now!
-
- Posts: 18
- Joined: Saturday 22 November 2014 8:02
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Blockly examples
Hi all - is there a way to accomplish the following:

What I have now is: when the system is armed, and the motion sensor is detecting presence in the hallway; send a notification of a possible intrusion and set some lights on.
Is there a way to delay this action, so you actually have e.g. 10 seconds to disarm the system using an RFID tag/Code? What I'm aiming to have is either an on-delay for the motion sensor (not preferred; because it also turns on the hallway lights when not armed); or some sort of delay in the next part (delay 10; check armed status again and (if motion = on) then alert).
I'm using version: v2.2136
Also, I'm having an issue with dimming lights on a timeframe. I'm trying to dim my lights to 40%; if the time is < then sunrise:
- this would work when turning on the light via off/on. However; when I've turned it on via the Level control - this blockly will not work, due to the fact that "set level" is the last state - and there's no way of detecting that in blockly. Is there a workaround?

What I have now is: when the system is armed, and the motion sensor is detecting presence in the hallway; send a notification of a possible intrusion and set some lights on.
Is there a way to delay this action, so you actually have e.g. 10 seconds to disarm the system using an RFID tag/Code? What I'm aiming to have is either an on-delay for the motion sensor (not preferred; because it also turns on the hallway lights when not armed); or some sort of delay in the next part (delay 10; check armed status again and (if motion = on) then alert).
I'm using version: v2.2136
Also, I'm having an issue with dimming lights on a timeframe. I'm trying to dim my lights to 40%; if the time is < then sunrise:

-
- Posts: 18
- Joined: Saturday 22 November 2014 8:02
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Blockly examples
In the mean time - here's some more examples:

This turns on the bathroom heating for 90 minutes on weekdays, except wednesday, at 0500 for 90 minutes. Making sure the bathroom is quite comfortable by the time you get up
(you might want to open the image in a new frame - as it's quite wide)

If the relative humidity level in the bathroom reaches 75% ( = taking a shower); then turn on the ventilation for at least 15 minutes. Should the humidity level not reach less than 75% in that time; it'll turn on the ventilation again for 15 minutes. This way, you don't have to emulate some kind of "hysteresis" and keeps the blockly event simple.

This event uses the script that allows "presence checking" by means of an IP. I have a smart TV; which in turn is connected to the network. If the lights are on in the TV room and it's after sunset; and the TV is on; then dim those lights to 20% - giving you a pleasant background lighting.
(again, you might want to open the image in a new frame - as it's quite wide)

This turns on the bathroom heating for 90 minutes on weekdays, except wednesday, at 0500 for 90 minutes. Making sure the bathroom is quite comfortable by the time you get up


If the relative humidity level in the bathroom reaches 75% ( = taking a shower); then turn on the ventilation for at least 15 minutes. Should the humidity level not reach less than 75% in that time; it'll turn on the ventilation again for 15 minutes. This way, you don't have to emulate some kind of "hysteresis" and keeps the blockly event simple.

This event uses the script that allows "presence checking" by means of an IP. I have a smart TV; which in turn is connected to the network. If the lights are on in the TV room and it's after sunset; and the TV is on; then dim those lights to 20% - giving you a pleasant background lighting.

-
- Posts: 267
- Joined: Tuesday 14 January 2014 14:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
I've done similar to this with my bathroom underfloor heating just using the timer on that switch.Wirehead wrote:In the mean time - here's some more examples:
This turns on the bathroom heating for 90 minutes on weekdays, except wednesday, at 0500 for 90 minutes. Making sure the bathroom is quite comfortable by the time you get up(you might want to open the image in a new frame - as it's quite wide)
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.
-
- Posts: 1
- Joined: Wednesday 03 December 2014 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Hi!
I'm trying to make a event for my lights. i Would like it to turn on 30 minutes before sunset and would like it to turn off at a given time on weekdays.
And on holidays i would like to use the same sunset rule but turn of at diferent times.
Is this possible?
Thanks!
I'm trying to make a event for my lights. i Would like it to turn on 30 minutes before sunset and would like it to turn off at a given time on weekdays.
And on holidays i would like to use the same sunset rule but turn of at diferent times.
Is this possible?
Thanks!
-
- Posts: 18
- Joined: Saturday 22 November 2014 8:02
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Blockly examples
afaik - scripting that specific time is probably only possible in LUA...
edit: should be doable using timers - see attached file
edit: should be doable using timers - see attached file
- Attachments
-
- timer.jpg (24.13 KiB) Viewed 45260 times
-
- Posts: 75
- Joined: Sunday 30 November 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hoorn, Netherlands
- Contact:
Re: Blockly examples
Hi there,
I just started with domoticz, what an awesome program! i'm having a problem with my thermostat. here is my situation:
virtual thermostat with set point.
orogon thermostat
switch for my thermostat. (used Mademoiselle_filou for testing)...
i made the next blockly, but it tuns on, directly off, after one minute on, directly of etc. etc.
It seems that the set point of the thermostat isn't used. even when the set point is below the actual tempeture (orogon) it turns on for a second, and then it turns off.
does anybody know how to use the thermostat set point in a right way with blockly?
thanks!
FLoris
I just started with domoticz, what an awesome program! i'm having a problem with my thermostat. here is my situation:
virtual thermostat with set point.
orogon thermostat
switch for my thermostat. (used Mademoiselle_filou for testing)...
i made the next blockly, but it tuns on, directly off, after one minute on, directly of etc. etc.
It seems that the set point of the thermostat isn't used. even when the set point is below the actual tempeture (orogon) it turns on for a second, and then it turns off.
does anybody know how to use the thermostat set point in a right way with blockly?
thanks!
FLoris
- Attachments
-
- verwarming_v4.png (27.68 KiB) Viewed 45184 times
-
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Blockly examples
Some events that i created:
Detect if there is someone home
Almost all my other events are based on this one. This event will tell Domoticz if there is someone home or not.
This event is based on two virtual switches, where one is switched by a geofence app on iPhone, and the other by this script: http://www.domoticz.com/wiki/Presence_detection

'IemandThuis' translates to 'SomeoneHome'
Switch on lights when we are home, and it is getting dark
This event turns on some lights when we are home, and it is starting to get dark. The variable is used so that the event is only triggered once. Otherwise it would trigger again when we turn off the lights by hand when we go to bed.

The '15min_before_zononder' is a virtual switch that turns on 15 min before sunset, and off at 0:01
Turn on lights when we arrive home and it is dark outside
This event turns on some lights when we arrive home and it is dark outside. The variable is used so that the event is only triggered once. Otherwise it would trigger again when we turn off the lights by hand when we go to bed.

First line ends with "IsDonker = On"
The "IsDonker" switch i use, is a virtual switch that is turned on/off by timers. It is turned on at sunset, and turned off at sunrise. This way it covers the whole 'dark' period of the evening/night. This is easy to use in events. By doing this my lights will never switch on accidentaly at daytime.
Unfortunately they are in Dutch, but i hope they are still useful for someone...
Detect if there is someone home
Almost all my other events are based on this one. This event will tell Domoticz if there is someone home or not.
This event is based on two virtual switches, where one is switched by a geofence app on iPhone, and the other by this script: http://www.domoticz.com/wiki/Presence_detection

'IemandThuis' translates to 'SomeoneHome'
Switch on lights when we are home, and it is getting dark
This event turns on some lights when we are home, and it is starting to get dark. The variable is used so that the event is only triggered once. Otherwise it would trigger again when we turn off the lights by hand when we go to bed.

The '15min_before_zononder' is a virtual switch that turns on 15 min before sunset, and off at 0:01
Turn on lights when we arrive home and it is dark outside
This event turns on some lights when we arrive home and it is dark outside. The variable is used so that the event is only triggered once. Otherwise it would trigger again when we turn off the lights by hand when we go to bed.

First line ends with "IsDonker = On"
The "IsDonker" switch i use, is a virtual switch that is turned on/off by timers. It is turned on at sunset, and turned off at sunrise. This way it covers the whole 'dark' period of the evening/night. This is easy to use in events. By doing this my lights will never switch on accidentaly at daytime.
Unfortunately they are in Dutch, but i hope they are still useful for someone...
Last edited by ThinkPad on Wednesday 07 January 2015 9:16, edited 2 times in total.
I am not active on this forum anymore.
Who is online
Users browsing this forum: No registered users and 1 guest