Blockly examples

Moderator: leecollings

User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: RE: Re: Blockly examples

Post by StanHD »

tozzke wrote:Sunset/rise have to be linked into the Time-blockly
Image
I think the "and" should be an "or" due to the 00:00 end of day within Domoticz. Image
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post by tozzke »

true, I was too focussed on the correct position of the blocks :)
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

fläkt.PNG
fläkt.PNG (7.53 KiB) Viewed 5547 times
Hi!

i have made a blocky like this:[img]
fläkt.PNG
fläkt.PNG (7.53 KiB) Viewed 5547 times
[/img]

it contols my bathroom fan, it works good but i can see in the log that it send an off command every minute when it goes below 49%
i dont know if it matters if the rfx sends an off command every minute, but it sure doesnt need to do that, how can i make the blocky so the rfx sends just one or a couple of off commands after the moisture % goes below 49%?

another stupid question is, is it called blocky or blockly?
User avatar
PeGe
Posts: 25
Joined: Tuesday 31 January 2017 14:21
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6328
Location: Sollentuna, Sweden
Contact:

Re: Blockly examples

Post by PeGe »

To avoid that unnecessary load, just include an AND in your condition, checking if 'Toalett fläkt' = On.

Like this:

if 'Toalett nere' < 49 AND 'Toalett fläkt' = On

/P-G
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

ofcourse , why didnt i think of that :)
i have fixed it now and im going to test it.
thanks.
AimoPaukku
Posts: 43
Joined: Saturday 28 January 2017 9:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Contact:

Re: Blockly examples

Post by AimoPaukku »

Hi...

How can i create this IF event?

IF it is cold outside(<10c I have virtual weatherstation) and any door(i can do doors or package) is left open for a 5min or more. Ignore if less.

Then I want a message (can do this part)
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post by tozzke »

AimoPaukku wrote:Hi...

How can i create this IF event?

IF it is cold outside(<10c I have virtual weatherstation) and any door(i can do doors or package) is left open for a 5min or more. Ignore if less.

Then I want a message (can do this part)
I'd say that this should do the trick:

Image

Change my 'TESTknop1 = On' into your 'temp < 10', my 'TESTknop2 = On' into your 'Doors = Open', my 'var TESTlamp1' into a variable to your liking, my switch 'TESTlamp1' into a dummy switch to your liking, my 'TESTknop1 = Off' into your 'Doors = Closed', my 'Write to log "WARNING!!!!! DOORS OPEN!!!!"' into your notification and my 10 seconds into your desired time in seconds.

The dummy switch 'TESTlamp1' is necessary because of the fact that Domoticz/Blockly won't allow you to change the very variable which you also use in the if-statement.

the log:

Code: Select all

2017-04-01 01:03:33.339 User: Admin initiated a switch command (123/TESTknop1/On)
2017-04-01 01:03:33.340 (TESTknop1) Lighting 2 (TESTknop1)
2017-04-01 01:03:35.427 User: Admin initiated a switch command (124/TESTknop2/On)
2017-04-01 01:03:35.457 EventSystem: Event triggered: TEST - 1-4-2017 - AimoPaukku Domoticz forum Blockly samples_1
2017-04-01 01:03:35.460 var TESTlamp1 = 1
2017-04-01 01:03:35.460 var TESTlamp1 = 2 after 10 seconds
2017-04-01 01:03:35.428 (TESTknop2) Lighting 2 (TESTknop2)
2017-04-01 01:03:35.746 (TESTlamp1) Lighting 1 (TESTlamp1)
2017-04-01 01:03:39.447 User: Admin initiated a switch command (124/TESTknop2/Off)
2017-04-01 01:03:39.478 EventSystem: Event triggered: TEST - 1-4-2017 - AimoPaukku Domoticz forum Blockly samples_3
2017-04-01 01:03:39.480 var TESTlamp1 = 0
2017-04-01 01:03:39.448 (TESTknop2) Lighting 2 (TESTknop2)
2017-04-01 01:03:39.775 (TESTlamp1) Lighting 1 (TESTlamp1)
2017-04-01 01:03:46.743 Set UserVariable TESTlamp1 = 2
2017-04-01 01:03:50.066 User: Admin initiated a switch command (124/TESTknop2/On)
2017-04-01 01:03:50.095 EventSystem: Event triggered: TEST - 1-4-2017 - AimoPaukku Domoticz forum Blockly samples_2
2017-04-01 01:03:50.097 WARNING!!!!! DOORS OPEN!!!!
2017-04-01 01:03:50.067 (TESTknop2) Lighting 2 (TESTknop2)
2017-04-01 01:03:50.371 (TESTlamp1) Lighting 1 (TESTlamp1)
2017-04-01 01:03:50.761 Set UserVariable TESTlamp1 = 0
2017-04-01 01:04:20.292 User: Admin initiated a switch command (124/TESTknop2/Off)
2017-04-01 01:04:20.293 (TESTknop2) Lighting 2 (TESTknop2)
2017-04-01 01:04:21.116 User: Admin initiated a switch command (123/TESTknop1/Off)
2017-04-01 01:04:21.117 (TESTknop1) Lighting 2 (TESTknop1)
PS: in lua it would be easier :p
In lua you can put the time condition in the if instead of in the output
anno
Posts: 36
Joined: Wednesday 01 March 2017 13:00
Target OS: Windows
Domoticz version: all
Contact:

Re: Blockly examples

Post by anno »

this is working only not all the time. for example this evening the tuin lights didn't turn off after 5 min. Why?
Attachments
blocky 1 tuin2.jpg
blocky 1 tuin2.jpg (326.63 KiB) Viewed 5156 times
long time domiticz user, running 8 domoticz installations on vm's nuc i3. And espeay hosting more than 30.
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Blockly examples

Post by Nautilus »

anno wrote:this is working only not all the time. for example this evening the tuin lights didn't turn off after 5 min. Why?
Depending of the lamp type, I've noticed "Off AFTER 5" works sometimes a lot better than "On FOR 5". It possibly has something to do with the states that are available for the lamp type. Basic On/Off works (maybe) well also with "On FOR XX" whereas dimming / RGB etc. bulbs need to use "Off AFTER XX"?

So I would change the first command to just "On" and then add a second command to each condition with "Off AFTER 5" :)
anno
Posts: 36
Joined: Wednesday 01 March 2017 13:00
Target OS: Windows
Domoticz version: all
Contact:

Re: Blockly examples

Post by anno »

Nautilus wrote:
anno wrote:this is working only not all the time. for example this evening the tuin lights didn't turn off after 5 min. Why?
Depending of the lamp type, I've noticed "Off AFTER 5" works sometimes a lot better than "On FOR 5". It possibly has something to do with the states that are available for the lamp type. Basic On/Off works (maybe) well also with "On FOR XX" whereas dimming / RGB etc. bulbs need to use "Off AFTER XX"?

So I would change the first command to just "On" and then add a second command to each condition with "Off AFTER 5" :)
Thanks you, i will try it
long time domiticz user, running 8 domoticz installations on vm's nuc i3. And espeay hosting more than 30.
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post by tozzke »

anno wrote:this is working only not all the time. for example this evening the tuin lights didn't turn off after 5 min. Why?
'On for x minutes' means that after the set time, it goes back to the previous setting.
If the light is already on (or rather... not off) it turns the light on again but after 5 minutes it goes to the previous state which was already on.
So probably the time the light didn't go off, it was already on when a sensor detected motion.

So you'll have to add the condition 'and Tuinverlichting = Off' to all if's or use the suggestion made by Nautilus
videodrome
Posts: 64
Joined: Wednesday 11 May 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by videodrome »

I made this script to bring the nest thermostat to 18 degrees when the window is opened.
the script works fine (open url"http://192.168.1.xxx:8080/json.htm?type ... &svalue=18")
How can run the script when the window is left open for more than five minutes? When x is open for more than 5 minutes, do....
Image
Caribou
Posts: 9
Joined: Thursday 20 April 2017 17:35
Target OS: Linux
Domoticz version:
Location: Bordeaux
Contact:

Re: Blockly examples

Post by Caribou »

Hi,
I'm a newbie with domoticz and beginning to play with events.
Could you please tell me what am I missing with this blocky scenario:
Image
My goal is to receive an email alert when a motion is detected between specific hours (next I will try to improve it, by receving only an email for the first motion of each day).
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Post by StanHD »

Caribou wrote:Hi,
I'm a newbie with domoticz and beginning to play with events.
Could you please tell me what am I missing with this blocky scenario:
Image
My goal is to receive an email alert when a motion is detected between specific hours (next I will try to improve it, by receving only an email for the first motion of each day).
If you only have an "If" but not an "Else If" then you should use the block without the blue "gear" symbol. ;)
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
videodrome
Posts: 64
Joined: Wednesday 11 May 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by videodrome »

videodrome wrote:I made this script to bring the nest thermostat to 18 degrees when the window is opened.
the script works fine (open url"http://192.168.1.xxx:8080/json.htm?type ... &svalue=18")
How can run the script when the window is left open for more than five minutes? When x is open for more than 5 minutes, do....
Image
anyone could help me?
four2six
Posts: 53
Joined: Wednesday 24 February 2016 9:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six »

quick idea: have a virtual switch, turn that switch on when the window opens and make it turn off after 5 minutes. when it turns off, open the url.
videodrome
Posts: 64
Joined: Wednesday 11 May 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by videodrome »

four2six wrote:quick idea: have a virtual switch, turn that switch on when the window opens and make it turn off after 5 minutes. when it turns off, open the url.
Thanx for the idea: now it works. The nest thermostat will be set to 18 degrees if the door remains open for at least 5 minutes, otherwise it will remain at the set temperature. "Finestra"is the virtual sensor
Image
four2six
Posts: 53
Joined: Wednesday 24 February 2016 9:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six »

better than what i said, well done :-)
Letalis
Posts: 9
Joined: Monday 28 November 2016 21:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by Letalis »

Tried to find a solution. But when I use blocky to lower my blind and notify me it sends multiple notifications.. I got like a notification every one minute or so.

Can you get blocky to only send notification once?
four2six
Posts: 53
Joined: Wednesday 24 February 2016 9:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six »

can you post the blockly?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest