Blockly examples

Moderator: leecollings

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

Post by bizziebis »

'Before sunrise' should be 'before sunset', other that it should work just fine. I use it a lot like this.
User avatar
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

Post by mvveelen »

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...
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
ErikCramer
Posts: 11
Joined: Saturday 01 February 2014 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by ErikCramer »

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

Measuring time is also not possible in blockly i think ?
If movement is detected for longer then 5 minutes then do ...
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by markk »

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.
Maby a feature request :-)
Just set the timer to turn on X minutes after sunset
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.
User avatar
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

Post by mvveelen »

ErikCramer wrote:
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...
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 :-)

Measuring time is also not possible in blockly i think ?
If movement is detected for longer then 5 minutes then do ...
Hi, I got mine working (never mind the 12:00....at least it works like this):

Sunrise

Image

Sunset

Image

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
xKingx
Posts: 15
Joined: Tuesday 03 June 2014 11:23
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Holland
Contact:

Re: Blockly examples

Post by xKingx »

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

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.
Image
Raspberry Pi running Domoticz image
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Blockly examples

Post by ThinkPad »

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.
  • 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 valid :lol: I 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 :lol:
I am not active on this forum anymore.
User avatar
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

Post by proohu01 »

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
xKingx
Posts: 15
Joined: Tuesday 03 June 2014 11:23
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Holland
Contact:

Re: Blockly examples

Post by xKingx »

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
bert
Posts: 17
Joined: Monday 27 October 2014 23:57
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by bert »

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?
dimmer
dimmer
blocky.PNG (46.58 KiB) Viewed 45560 times
not that I expected anything from it; a 'chime' event is not working ;-)
sneaksneak
Posts: 7
Joined: Wednesday 12 February 2014 15:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by sneaksneak »

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?
Hendrik
Posts: 18
Joined: Saturday 04 January 2014 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Blockly examples

Post by Hendrik »

Try this
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
sneaksneak
Posts: 7
Joined: Wednesday 12 February 2014 15:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by sneaksneak »

Thanks. Its woking now!
Wirehead
Posts: 18
Joined: Saturday 22 November 2014 8:02
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by Wirehead »

Hi all - is there a way to accomplish the following:
Image
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:
Image - 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?
Wirehead
Posts: 18
Joined: Saturday 22 November 2014 8:02
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by Wirehead »

In the mean time - here's some more examples:

Image
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)

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

Image
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. 8-) (again, you might want to open the image in a new frame - as it's quite wide)
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by markk »

Wirehead wrote:In the mean time - here's some more examples:

Image
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)
I've done similar to this with my bathroom underfloor heating just using the timer on that switch.
image.jpg
image.jpg (156.14 KiB) Viewed 45354 times
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.
Danne
Posts: 1
Joined: Wednesday 03 December 2014 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by Danne »

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!
Wirehead
Posts: 18
Joined: Saturday 22 November 2014 8:02
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by Wirehead »

afaik - scripting that specific time is probably only possible in LUA...
edit: should be doable using timers - see attached file
Attachments
timer.jpg
timer.jpg (24.13 KiB) Viewed 45258 times
floris74
Posts: 75
Joined: Sunday 30 November 2014 8:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hoorn, Netherlands
Contact:

Re: Blockly examples

Post by floris74 »

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
Attachments
verwarming_v4.png
verwarming_v4.png (27.68 KiB) Viewed 45182 times
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Blockly examples

Post by ThinkPad »

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
Image
'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.
Image
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.
Image
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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest