Page 13 of 36

Re: Blockly examples

Posted: Monday 07 December 2015 19:15
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?

Re: Blockly examples

Posted: Monday 07 December 2015 19:42
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.

Re: Blockly examples

Posted: Tuesday 15 December 2015 18:14
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

Re: Blockly examples

Posted: Sunday 03 January 2016 10:14
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!

Re: Blockly examples

Posted: Tuesday 05 January 2016 2:02
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 5630 times
12494389_10153149501766739_1869370372_o.jpg
12494389_10153149501766739_1869370372_o.jpg (133.78 KiB) Viewed 5630 times
EDIT: Still som bugs in this, trying to fix

Re: Events: Blockly examples

Posted: Wednesday 06 January 2016 18:36
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 5582 times

Re: Events: Blockly examples

Posted: Wednesday 06 January 2016 18:39
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.

Re: Events: Blockly examples

Posted: Wednesday 06 January 2016 18:45
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!

Re: Events: Blockly examples

Posted: Wednesday 06 January 2016 22:50
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

Re: Blockly examples

Posted: Saturday 09 January 2016 13:40
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?

Re: Blockly examples

Posted: Sunday 10 January 2016 20:55
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.

Re: Blockly examples

Posted: Tuesday 12 January 2016 17:26
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

Re: Blockly examples

Posted: Wednesday 13 January 2016 10:34
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

Re: Blockly examples

Posted: Monday 18 January 2016 20:55
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 :)

Re: Blockly examples

Posted: Monday 18 January 2016 21:33
by elmortero
I don't know about curtains but with blinds you use Off for open and On for closed

Re: Blockly examples

Posted: Tuesday 19 January 2016 7:38
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!

Re: Blockly examples

Posted: Saturday 30 January 2016 17:14
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!

Re: Blockly examples

Posted: Sunday 31 January 2016 22:53
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.

Re: Blockly examples

Posted: Monday 01 February 2016 20:02
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 ;)

Re: Blockly examples

Posted: Wednesday 03 February 2016 21:36
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 5111 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?