Blockly examples

Must be cleaned all topics go to the right subforum
Benneton
Posts: 8
Joined: Thursday 08 December 2016 10:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton » Friday 15 September 2017 16:02

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: 8
Joined: Thursday 08 December 2016 10:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton » Friday 15 September 2017 16:29

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 518 times
and one to trigger brighter light when motion is detected:
motion.png
motion.png (85.64 KiB) Viewed 518 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: 24
Joined: Thursday 04 February 2016 14:06
Target OS: Raspberry Pi
Domoticz version: 3.530
Location: Emmen, Drenthe
Contact:

Re: Blockly examples

Post by martijnm » Tuesday 19 September 2017 12:57

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: 653
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Blockly examples

Post by Nautilus » Tuesday 19 September 2017 14:27

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 » Sunday 24 September 2017 18:05

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: 29
Joined: Friday 12 February 2016 21:58
Target OS: Raspberry Pi
Domoticz version: 3.4834
Contact:

Re: Blockly examples

Post by cobra045 » Sunday 24 September 2017 20:10

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 » Monday 25 September 2017 20:51

Hallo Cobra,
Thanks for the quick reply Does this look correct?
Blocky.jpg
Blocky.jpg (69.05 KiB) Viewed 339 times
it is also not running.
Thanks in advance
Chirs

cobra045
Posts: 29
Joined: Friday 12 February 2016 21:58
Target OS: Raspberry Pi
Domoticz version: 3.4834
Contact:

Re: Blockly examples

Post by cobra045 » Thursday 28 September 2017 21:27

Hi Chris68,

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

Cobra045

frigide
Posts: 2
Joined: Friday 08 September 2017 18:38
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by frigide » Thursday 28 September 2017 23:31

Is there a blocky way to change te color and brightness settings of my Xiaomi Gateway.

kluczus
Posts: 9
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by kluczus » Wednesday 04 October 2017 7:40

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 186 times
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests