Blockly examples

Moderator: leecollings

edje1205
Posts: 34
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

Hi tozzke

thanx for quick reply !

Now I have this : see att

Still no action. Strange if I physicly connect a light with the dusk sensor (as it is what kaku does main, or I click dusk sensor) that lamp goes on, but no actions in script :roll:

Beside that
In this script will be 'else if' in fact 'do nothing if the light(s) are on yet'. So how can I set blockly in 'do nothing' ?
otherwise (as in your example) , how to say 'do nothing' in lua language ´if connect then end´ or so ?
May be easier in lua ?
Attachments
dusk script2.jpg
dusk script2.jpg (85.15 KiB) Viewed 4413 times
edje1205
Posts: 34
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

This 'seems' to work ! :) waiting .........
Attachments
dusk script 3.jpg
dusk script 3.jpg (112.63 KiB) Viewed 4412 times
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 »

Except I don't think 'Stopped' does anything with a light :D
edje1205
Posts: 34
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

Stopped the script at that point maybe ?
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 »

edje1205 wrote:Stopped the script at that point maybe ?
No, that means it is trying to set the switches to state "Stopped" :)

No need have any separate "stop" commands, it runs when the conditions are met. If you do not need the script to turn the lights off at some point, you don't need the "else if" part at all...
Last edited by Nautilus on Thursday 26 January 2017 22:56, edited 1 time in total.
edje1205
Posts: 34
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

:-)

Case closed hm ?
kdalmeijer
Posts: 2
Joined: Friday 27 January 2017 14:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by kdalmeijer »

Hi guys,

I'm new to the forum and hope you don't mind me asking help for my non-functional blockly. Not entirely true, it does function, but not the way I would expect it to... and what else is new here? :D

Here's the blockly:
2017-01-27 14_22_21-Domoticz.png
2017-01-27 14_22_21-Domoticz.png (37.51 KiB) Viewed 4354 times
It's all about the central ventilation system in the house. I use a Netatmo weather station to read the humidity both in the living room (woonkamer) and in the bathroom (badkamer). Due the the issue I was having with the values from Netatmo, I decided to copy the values to user variables as you can see here:
2017-01-27 14_20_37-Domoticz.png
2017-01-27 14_20_37-Domoticz.png (14.96 KiB) Viewed 4354 times
These values are correct and consistent with what the Netatmo app tells me.

Now the thing is that this blockly considers both situations, humidity above 50 and humidity below 50 to be correct as the logfile shows my debug messages:
2017-01-27 14_23_12-Domoticz.png
2017-01-27 14_23_12-Domoticz.png (8.26 KiB) Viewed 4354 times
I am absolutely puzzled as to why this is happening...
I hope someone is willing and able to help me with this. Thanks in advance!!


BTW: I used the time<>00:00 to get this event to fire every minute so a spend less time testing whether my blockly works :D
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 »

The problem is probably the "Nested" structure you have used. Blockley does not work with nested "If"s.
Can you try re-structuring by repeating the "time<>00:00" criteria within the "if" and "else if" sections therefore losing the outer "If" block?
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
kdalmeijer
Posts: 2
Joined: Friday 27 January 2017 14:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by kdalmeijer »

@StanHD You are my absolute hero! Thanks for pointing that out to me!

This is what I ended up with, and it does exactly what I want. I'll expand from here, adding both speeds of the ventilation and adding CO2 measurements from the Netatmo modules. Happy! :D

Thanks again!
2017-01-27 15_44_09-Domoticz.png
2017-01-27 15_44_09-Domoticz.png (35.49 KiB) Viewed 4341 times
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 »

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
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Blockly examples

Post by tontze »

Hi ! My second attempt on making blockly :) I cant figure out why this wont work .. Im trying to achieve automatic lights on after sunset.

If i add just motion sensor, it works.
Attachments
sunset.PNG
sunset.PNG (33.35 KiB) Viewed 4287 times
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
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 »

This will only trigger when it is = Sunset (a moment in time) and the motion sensor is on. Try changing to > Sunset and the motion sensor is on. Be aware that > Sunset expires at midnight in Domoticz.
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
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Blockly examples

Post by tontze »

StanHD wrote:This will only trigger when it is = Sunset (a moment in time) and the motion sensor is on. Try changing to > Sunset and the motion sensor is on. Be aware that > Sunset expires at midnight in Domoticz. Image
Gotta try that, i also tried this: didnt work either :(
Attachments
sunset2.PNG
sunset2.PNG (18.16 KiB) Viewed 4283 times
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Blockly examples

Post by tontze »

And changing = to > or < didnt work :/
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
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 »

Ok, you could try making a dummy switch called something like "Is Dark". Set up the switch's timers to on at sunset, off at sunrise. Then use this switch status in your Blockly.
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
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Blockly examples

Post by tontze »

StanHD wrote:Ok, you could try making a dummy switch called something like "Is Dark". Set up the switch's timers to on at sunset, off at sunrise. Then use this switch status in your Blockly.
Thnx ! that worked !
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
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 »

tontze wrote:
StanHD wrote:This will only trigger when it is = Sunset (a moment in time) and the motion sensor is on. Try changing to > Sunset and the motion sensor is on. Be aware that > Sunset expires at midnight in Domoticz. Image
Gotta try that, i also tried this: didnt work either :(
Somehow some people manage to mix the blocks in a way it doesn't work :roll:
It isn't that difficult... Mind the brackets

Code: Select all

If [[[Time >= [Sunset]] or [Time <= [Sunrise]]] and [[Motion] = [On]]]
Do [Set [Kitchen lights] = [Off] After [3*] seconds]
* Domoticz/blockly doesn't allow timed events shorter than 3 seconds
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Blockly examples

Post by tontze »

tozzke wrote:
tontze wrote:
StanHD wrote:This will only trigger when it is = Sunset (a moment in time) and the motion sensor is on. Try changing to > Sunset and the motion sensor is on. Be aware that > Sunset expires at midnight in Domoticz. Image
Gotta try that, i also tried this: didnt work either :(
Somehow some people manage to mix the blocks in a way it doesn't work :roll:
It isn't that difficult... Mind the brackets

Code: Select all

If [[[Time >= [Sunset]] or [Time <= [Sunrise]]] and [[Motion] = [On]]]
Do [Set [Kitchen lights] = [Off] After [3*] seconds]
* Domoticz/blockly doesn't allow timed events shorter than 3 seconds
Thats good to know :) Was that the problem with my blockly ? I still dont see anything wrong with it (besides that 1sec that i know now).

Oh, just now i remembered that i used 1sec delay with motion to start lights (without sunset) and it worked ?
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Blockly examples

Post by tontze »

Oh, now i see it :) Open brackets left behind right ?
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
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 »

Sunset/rise have to be linked into the Time-blockly
Image
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest