Blockly examples

Moderator: leecollings

Benneton
Posts: 111
Joined: Thursday 08 December 2016 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton »

Hi Chatjozef,

Thanks for the hint, I thought of this, but it adds extra lines, 7 in total as we cannot work with groups.
It does not solve my problem. I think that blocky is not to intelligent. I have the feeling that every so many seconds the script is run.
So when my motion sensor is triggered lights will go to 50%, then when script runs again, it starts with the first line, stating to switch on lights at 10%, when conditions are met, and that is with all testing I did after approx. 35 seconds.

I will try to split the script into 2 events. One for turning on lights via Dusk Sensor and one for when motion is detected and lights will have to go up to 50% for 2 min.

In general my feeling is that the "set xxxx = yyyy for zz min" is not working as it should.
It there someone out here that has this statement working as it should?

Will LUA overcome the way scripts are handled?
Benneton
Posts: 111
Joined: Thursday 08 December 2016 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton »

All,

Just split it up in 2 blocky scripts:
one to switch on/off via Dusk sensor:
Dusk.png
Dusk.png (23.85 KiB) Viewed 15316 times
and one to trigger brighter light when motion is detected:
motion.png
motion.png (85.64 KiB) Viewed 15316 times
Just checked and now light return to 10% after approx. 65 seconds, still 55 short from the 120..

I am not sure anymore Domotics can do what I want (which I believe to be very simple):
Switch light on when Dusk sensor is on and when motion is detected brighten lights to 50% for 2 min.

Help is much appreciated.
Bernard
martijnm
Posts: 26
Joined: Thursday 04 February 2016 13:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.530
Location: Emmen, Drenthe
Contact:

Re: Blockly examples

Post by martijnm »

I have created a Selector Switch with 3 values: Day, Evening or Night. A timer has been set which changes the switch's value at sunset, midnight and sunrise.

Image

Now I want to select the correct scene when motion has been detected. A full bright scene during daylight, a relaxed scene in the evening and a low-light scene during nightly hours. Also a virtual switch will be set (with auto-off after 1 hour) to make sure the motion sensor does not overrule a scene which has been manually set.

I have created this blockly script:

Image

However, the script does not work. This is what has been recorded in the log (translated):
2017-09-19 11:24:33.890 Motion in bathroom. Lights "Daglicht" switched off.
2017-09-19 11:24:33.890 Motion in bathroom. Lights "Ontspanning" switched off.
2017-09-19 11:24:33.890 Motion in bathroom. Lights "Boven het bad rood" switched on.
2017-09-19 11:26:33.606 No motion detected in bathroom. Lights will switch off after 1 hour.

As you can see, all scenes will run at the same moment.

I have also tried to use level which does not work either: Image

Can anyone explain how can I can check the value of a Selector Switch in Blockly?
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 »

Two important things to remember with Domoticz Blockly implementation. Nested if's do not work and each (else)if-clause in is executed with multiple else-if (and else). So the above needs to be written without the nested if. You are using the correct way to check selector state. When checking the level -> refer to level name; when setting the level -> refer to level value.
chris68
Posts: 2
Joined: Sunday 24 September 2017 17:47
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by chris68 »

Hello All,

I am running the same blocky configuration for temperature control running on a fresh install of version v3.8153 on a Raspberry PI noobs.
The temperature is coming from the EQ3 Max! lua scripts. In the logs there are no event entries for the two temperature blocky events. When I set a time event it is run without a problem.
Stanleyk wrote: Friday 15 September 2017 15:52 still not work :(

Image

But I dont see nothing in the log about running script or errors.. is it ok ?
What could be the cause where can I look to try to get this running?
Thanks
Chris
cobra045
Posts: 46
Joined: Friday 12 February 2016 20:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

Re: Blockly examples

Post by cobra045 »

Hi Stanleyk,

try this

IF teplota1 > 10 and teplota1 < 28 and Relay 1 = off
Do Set Relay1 = on
Else if teplota1 > 29 and teplota1 < 50 and Relay 1 = on
Do Set Relay 1 = off

Or

IF teplota1 < 28 and Relay 1 = off
Do Set Relay 1 = on
Else if teplota1 > 29 and Relay 1 = on
Do Set Relay 1 = off

Use the option "Else if" and not the option "if"

Cobra045
chris68
Posts: 2
Joined: Sunday 24 September 2017 17:47
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by chris68 »

Hallo Cobra,
Thanks for the quick reply Does this look correct?
Blocky.jpg
Blocky.jpg (69.05 KiB) Viewed 15182 times
it is also not running.
Thanks in advance
Chirs
cobra045
Posts: 46
Joined: Friday 12 February 2016 20:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

Re: Blockly examples

Post by cobra045 »

Hi Chris68,

I think 19.1 and 22.1 do not work.
First try something simple

Cobra045
frigide
Posts: 4
Joined: Friday 08 September 2017 18:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by frigide »

Is there a blocky way to change te color and brightness settings of my Xiaomi Gateway.
kluczus
Posts: 24
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by kluczus »

frigide wrote: Thursday 28 September 2017 23:31 Is there a blocky way to change te color and brightness settings of my Xiaomi Gateway.
Yes of course, just add scene and activate it by blocky.
Attachments
Przechwytywanie.PNG
Przechwytywanie.PNG (175.7 KiB) Viewed 14985 times
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!
rudiraz
Posts: 10
Joined: Thursday 31 December 2015 16:00
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Blockly examples

Post by rudiraz »

Hi,

I have a little problem.
I want to switch the "AutoRaspiRemote_Aktiv"-switch on IF switch "Temp.Test" AND switch "Temp.Test.1" is set to ON.

And if switch "Temp.Test" OR switch "Temp.Test.1" is set to Off, "AutoRaspiRemote_Aktiv"-switch must set to OFF

at first i tried it like the picture below but nothing changed. I also tried it wirt uservariables but nothing happened.
What did I wrong?

I hope someone can help me

Greetings
Attachments
sw.PNG
sw.PNG (11.79 KiB) Viewed 14646 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 »

If you use only one If statement, you'll have to use the other If-block without the blue icon on the top left
rudiraz
Posts: 10
Joined: Thursday 31 December 2015 16:00
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Blockly examples

Post by rudiraz »

Hi,
I have solved my Problem with including the state of "AutoRaspiRemote_Aktiv" in the IF-Question:

IF <Switch.1 is> on AND <Switch.2> is on AND <AutoRaspiRemote_Aktiv> is on THEN SET <AutoRaspiRemote_Aktiv> off
sapa
Posts: 7
Joined: Saturday 26 August 2017 21:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by sapa »

Hi,

I'm trying to make Blockly to set "on" my hot water circulation pump(pompa obiegowa) for 2 minutes after PIR (zone:schody) sensor is on, then script should stop pump for next few minutes (for test it is 180sec ).My goal is to get max 1minut of working for 20 minutes.
Unfortunately after first circle system get's some kind a loop and all the time it is seting Var=0 (obiegowa_timer). Mayby someone could find mistake in my blocks?

2017-11-20 23:05:34.178 Set UserVariable obiegowa_timer = 0
2017-11-20 23:05:42.463 Satel Integra: switched output 24 to on
2017-11-20 23:05:44.143 Set UserVariable obiegowa_timer = 0
2017-11-20 23:05:54.176 Set UserVariable obiegowa_timer = 0
2017-11-20 23:06:04.134 Set UserVariable obiegowa_timer = 0
2017-11-20 23:06:14.298 Set UserVariable obiegowa_timer = 0
2017-11-20 23:06:24.214 Set UserVariable obiegowa_timer = 0
2017-11-20 23:06:34.179 Set UserVariable obiegowa_timer = 0
2017-11-20 23:06:42.355 Satel Integra: switched output 24 to off
2017-11-20 23:06:44.208 Set UserVariable obiegowa_timer = 0
2017-11-20 23:06:54.381 Set UserVariable obiegowa_timer = 0
2017-11-20 23:07:04.181 Set UserVariable obiegowa_timer = 0
2017-11-20 23:07:14.183 Set UserVariable obiegowa_timer = 0
2017-11-20 23:07:24.403 Set UserVariable obiegowa_timer = 0
2017-11-20 23:07:34.240 Set UserVariable obiegowa_timer = 0
2017-11-20 23:07:44.205 Set UserVariable obiegowa_timer = 0
2017-11-20 23:07:54.275 Set UserVariable obiegowa_timer = 0
2017-11-20 23:08:04.311 Set UserVariable obiegowa_timer = 0
Attachments
block.JPG
block.JPG (53.3 KiB) Viewed 14411 times
Hempie
Posts: 11
Joined: Wednesday 15 November 2017 17:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Aalsmeer
Contact:

Re: Blockly examples

Post by Hempie »

After some days struggle i hope someone is pointing me into the right direction.

I got a (3)Fibaro Smoke Sensors (FGSD-002) and some Somfy RTS shutters.
In case of Fire i want my shutters open on detection.
Smoke_detection_Open_Shutter.png
Noting is working, even if i change ''panic'' to ''on'

What im i doing wrong here :oops: '
Last edited by Hempie on Thursday 23 November 2017 22:35, edited 3 times in total.
RFXTRX433E, Aeon Z-Stick Gen 5, Harmony Hub, Nefit Easy, Homebridge, Somfy RTS, Fibaro
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 »

If Rook Alarm = Panic ?
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
Hempie
Posts: 11
Joined: Wednesday 15 November 2017 17:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Aalsmeer
Contact:

Re: Blockly examples

Post by Hempie »

StanHD wrote: Thursday 23 November 2017 22:28 If Rook Alarm = Panic ?
Rebuild it, this is how i tested it :D

*post updated
RFXTRX433E, Aeon Z-Stick Gen 5, Harmony Hub, Nefit Easy, Homebridge, Somfy RTS, Fibaro
Hempie
Posts: 11
Joined: Wednesday 15 November 2017 17:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Aalsmeer
Contact:

Re: Blockly examples

Post by Hempie »

Firedetection & open shutters

This seems to be working.
Smoke_detection_Open_Shutter.png
Smoke_detection_Open_Shutter.png (53.81 KiB) Viewed 14302 times
RFXTRX433E, Aeon Z-Stick Gen 5, Harmony Hub, Nefit Easy, Homebridge, Somfy RTS, Fibaro
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 »

Hempie wrote: Sunday 26 November 2017 8:47 Firedetection & open shutters

This seems to be working.
Smoke_detection_Open_Shutter.png
I don't think this will work because you have to specify the status of every smoke detector/switch, Blockly won't allow it like the way you did.
It should be:

Code: Select all

If [Rookmelder Hal] = [On] or [Rookmelder Overloop] = [On] or [Rookmelder Zolder] = [On]
Do ...
Hempie
Posts: 11
Joined: Wednesday 15 November 2017 17:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Aalsmeer
Contact:

Re: Blockly examples

Post by Hempie »

Thank you @tozzke i will test this when i'm home.
RFXTRX433E, Aeon Z-Stick Gen 5, Harmony Hub, Nefit Easy, Homebridge, Somfy RTS, Fibaro
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest