Blockly examples

Moderator: leecollings

User avatar
MarcelMAH
Posts: 53
Joined: Friday 04 December 2015 23:35
Target OS: Linux
Domoticz version: v3.8025
Location: Goes, Netherlands
Contact:

Re: Blockly examples

Post by MarcelMAH »

StanHD wrote:This one works for sure:-

Image
I have no idea how you set up your blocky... it looks like you start with and, but shouldn't there be something on the left of the and?
Running Domoticz on Ubuntu 16.04 on VMware with RFXCOM - RFXtrx433 and Aeotec Z-Stick Gen5
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 »

It works as it reads line by line:-

If any 1 of the conditions is true ("or" block) and another condition is true ("and" block) then do something.

Else if all of the conditions is true ("and" block) then do something else.

I hope that doesn't confuse things, but as above, just read across line by line.
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
rwonder
Posts: 1
Joined: Saturday 30 May 2015 14:46
Target OS: Windows
Domoticz version:
Contact:

Re: Blockly examples

Post by rwonder »

I've got a Zipator RGBW and would like to change the colors through blockly. So far I only see actions around on/off or dimming. Is it possible to use blockly for changing the color?

If not, does someone have a lua color change example maybe?

Update: possible through json
/json.htm?type=command&param=setcolbrightnessvalue&idx=5&hue=30&brightness=100&iswhite=false
viewtopic.php?f=4&t=5302&p=33981&hilit= ... lor#p33981
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Blockly examples

Post by remb0 »

I have an nodemcu connected to my buva remote control.
and with 4 virtual switches I can control the buttons.
-- 1
http://192.168.0.60/control?cmd=GPIO,13,1
http://192.168.0.60/control?cmd=GPIO,13,0
-- 2
http://192.168.0.60/control?cmd=GPIO,12,1
http://192.168.0.60/control?cmd=GPIO,12,0
-- 3
http://192.168.0.60/control?cmd=GPIO,14,1
http://192.168.0.60/control?cmd=GPIO,14,0
-- 4
http://192.168.0.60/control?cmd=GPIO,15,1
http://192.168.0.60/control?cmd=GPIO,15,0

Now there is a multistate selector/switch I have created an blocky.
if stand = 1 then virtuele switch 1 = on.

is it possible to remove my 4 switches and add this to blocky:
if stand = 1 then http://192.168.0.60/control?cmd=GPIO,13,1
when i open url, log give me:

2016-01-03 10:17:21.020 Stand 4
2016-01-03 10:17:21.020 EventSystem: Fetching url...
2016-01-03 10:17:21.021 Error: EventSystem: Malformed action sequence!
Evelen
Posts: 234
Joined: Thursday 09 July 2015 12:03
Target OS: Linux
Domoticz version: 2.4538
Location: Norway
Contact:

Re: Blockly examples

Post by Evelen »

This blockly send me a notification when robot vacuum cleaner is finished.
If the vacuum cleaner is not back on docking in 90 min it sed a notification because it probably jammed
støvsuger.png
støvsuger.png (218.74 KiB) Viewed 5638 times
12494389_10153149501766739_1869370372_o.jpg
12494389_10153149501766739_1869370372_o.jpg (133.78 KiB) Viewed 5638 times
EDIT: Still som bugs in this, trying to fix
darne
Posts: 7
Joined: Wednesday 06 January 2016 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version: v 3.4834
Location: Sweden
Contact:

Re: Events: Blockly examples

Post by darne »

bistoury wrote:My first heating scenario.
I am afraid I will need to dig into LUA...
The attachment blocky_heating_19.jpg is no longer available
I can't get multiple inputs after an "and", how is that done?
and..JPG
and..JPG (18.45 KiB) Viewed 5590 times
User avatar
MarcelMAH
Posts: 53
Joined: Friday 04 December 2015 23:35
Target OS: Linux
Domoticz version: v3.8025
Location: Goes, Netherlands
Contact:

Re: Events: Blockly examples

Post by MarcelMAH »

darne wrote:
bistoury wrote:My first heating scenario.
I am afraid I will need to dig into LUA...
blocky_heating_19.jpg
I can't get multiple inputs after an "and", how is that done?
and..JPG
I had the same... right click and choose External Inputs, or when they are, Inline inputs.
Running Domoticz on Ubuntu 16.04 on VMware with RFXCOM - RFXtrx433 and Aeotec Z-Stick Gen5
darne
Posts: 7
Joined: Wednesday 06 January 2016 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version: v 3.4834
Location: Sweden
Contact:

Re: Events: Blockly examples

Post by darne »

MarcelMAH wrote:
darne wrote:
bistoury wrote:My first heating scenario.
I am afraid I will need to dig into LUA...
blocky_heating_19.jpg
I can't get multiple inputs after an "and", how is that done?
and..JPG
I had the same... right click and choose External Inputs, or when they are, Inline inputs.
Figured out the rightklick manouver right after iv'e sent the question, thanx anyway for extremely fast response!
Evelen
Posts: 234
Joined: Thursday 09 July 2015 12:03
Target OS: Linux
Domoticz version: 2.4538
Location: Norway
Contact:

Re: Events: Blockly examples

Post by Evelen »

darne wrote:
bistoury wrote:My first heating scenario.
I am afraid I will need to dig into LUA...
blocky_heating_19.jpg
I can't get multiple inputs after an "and", how is that done?
and..JPG
Like this: viewtopic.php?f=15&t=9774
FutureCow
Posts: 8
Joined: Monday 30 December 2013 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by FutureCow »

I'm trying to make a blocky sending a notificantion. But i can't find Pushalot in the dropdown list inside the blocky.
How can i use blocky to send a notification with Pushalot?
mKotek
Posts: 68
Joined: Wednesday 30 December 2015 23:54
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Poland
Contact:

Re: Blockly examples

Post by mKotek »

remb0 wrote:I have an nodemcu connected to my buva remote control.
and with 4 virtual switches I can control the buttons.
-- 1
http://192.168.0.60/control?cmd=GPIO,13,1
http://192.168.0.60/control?cmd=GPIO,13,0
-- 2
http://192.168.0.60/control?cmd=GPIO,12,1
http://192.168.0.60/control?cmd=GPIO,12,0
-- 3
http://192.168.0.60/control?cmd=GPIO,14,1
http://192.168.0.60/control?cmd=GPIO,14,0
-- 4
http://192.168.0.60/control?cmd=GPIO,15,1
http://192.168.0.60/control?cmd=GPIO,15,0

Now there is a multistate selector/switch I have created an blocky.
if stand = 1 then virtuele switch 1 = on.

is it possible to remove my 4 switches and add this to blocky:
if stand = 1 then http://192.168.0.60/control?cmd=GPIO,13,1
when i open url, log give me:

2016-01-03 10:17:21.020 Stand 4
2016-01-03 10:17:21.020 EventSystem: Fetching url...
2016-01-03 10:17:21.021 Error: EventSystem: Malformed action sequence!
Like I have written in another topic, for URL containing ',' (comma sign, sigh!), one needs to urlencode it to %2C - then it works fine.
Last edited by mKotek on Tuesday 12 January 2016 17:42, edited 1 time in total.
Michal 'Kotek', greetings from Poland. Zapraszam na mój blog o automatyce domowej po polsku: http://www.ukotka.com.
rtulp
Posts: 8
Joined: Tuesday 05 January 2016 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by rtulp »

Hi,

My first Blocky script, but it's not working, what is wrong? I want my curtains to close at sunrise and sunset, but don't want to use the > or <, because maybe you want to open or close the curtains afterwards (example enter the balcony).

Image
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Blockly examples

Post by elmortero »

FutureCow wrote:I'm trying to make a blocky sending a notificantion. But i can't find Pushalot in the dropdown list inside the blocky.
How can i use blocky to send a notification with Pushalot?
You don't select it within Blockly
Go to the domoticz settings, in the section "notifications" you select and configure the type of notifications you want to use. Then in blockly you use "Send notification with subject.." and the notification will be sent with (all) the type of notifications you configured
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 »

rtulp wrote:Hi,

My first Blocky script, but it's not working, what is wrong? I want my curtains to close at sunrise and sunset, but don't want to use the > or <, because maybe you want to open or close the curtains afterwards (example enter the balcony).

Image
The If and Else if lines are good but I think that the Do Set had to be On and/or Off in stead of Closed/Open :)
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Blockly examples

Post by elmortero »

I don't know about curtains but with blinds you use Off for open and On for closed
rtulp
Posts: 8
Joined: Tuesday 05 January 2016 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by rtulp »

elmortero wrote:I don't know about curtains but with blinds you use Off for open and On for closed
Thanks! That makes sense!
djgodlike
Posts: 32
Joined: Wednesday 27 January 2016 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Blockly examples

Post by djgodlike »

ThinkPad wrote: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...
Hi Thinkpad,

I tried to get your example working at home, but without any luck. I can't get the "var" part to work.
I managed to make a working switch "IemandThuis" but the second and third part of your examples are a problem.
Can you please tell me how you made the variable parts: "Schemer_licht_aan" and "Thuiskomen_licht_aan" and do i need to make scripts and put them in the scripts folder?

I couldn't find it anywhere. I'm new :)

You can PM me in dutch aswell!

Thanks in advance!
Aeon Labs Gen5 USB
Greenwave Powernode 6 NS310
2x Greenwave Powernode 1 NS310
Philips Hue
Logitech media Server
Plugwise Smile P1
maomanna
Posts: 94
Joined: Monday 30 November 2015 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by maomanna »

no, you need to make a variable named "schemer_licht_aan" as integer and set value 0.
after that blockly can change the value as in the example above.
djgodlike
Posts: 32
Joined: Wednesday 27 January 2016 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Blockly examples

Post by djgodlike »

maomanna wrote:no, you need to make a variable named "schemer_licht_aan" as integer and set value 0.
after that blockly can change the value as in the example above.
Thank you very much! Got it working now, and understand the blocky! :)
Sorry just a beginner ;)
Aeon Labs Gen5 USB
Greenwave Powernode 6 NS310
2x Greenwave Powernode 1 NS310
Philips Hue
Logitech media Server
Plugwise Smile P1
Martijn85
Posts: 53
Joined: Wednesday 20 January 2016 20:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post by Martijn85 »

Hello everybody,

Maybe someone can help me out with this small issue. These are my blocks:
2016_02_03_21_31_54_Domoticz.png
2016_02_03_21_31_54_Domoticz.png (21.81 KiB) Viewed 5119 times
This works but when one phone is off and one phone is on the switch Iemand Thuis (Someone Home) is switching every second from on to off. When the second phone is coming online the switch keeps on like ik should. Why, when one phone is off, the switch is switching from on to off?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest