Page 26 of 36

Re: Blockly examples

Posted: Friday 15 September 2017 16:02
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?

Re: Blockly examples

Posted: Friday 15 September 2017 16:29
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 15314 times
and one to trigger brighter light when motion is detected:
motion.png
motion.png (85.64 KiB) Viewed 15314 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

Re: Blockly examples

Posted: Tuesday 19 September 2017 12:57
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?

Re: Blockly examples

Posted: Tuesday 19 September 2017 14:27
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.

Re: Blockly examples

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

Re: Blockly examples

Posted: Sunday 24 September 2017 20:10
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

Re: Blockly examples

Posted: Monday 25 September 2017 20:51
by chris68
Hallo Cobra,
Thanks for the quick reply Does this look correct?
Blocky.jpg
Blocky.jpg (69.05 KiB) Viewed 15180 times
it is also not running.
Thanks in advance
Chirs

Re: Blockly examples

Posted: Thursday 28 September 2017 21:27
by cobra045
Hi Chris68,

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

Cobra045

Re: Blockly examples

Posted: Thursday 28 September 2017 23:31
by frigide
Is there a blocky way to change te color and brightness settings of my Xiaomi Gateway.

Re: Blockly examples

Posted: Wednesday 04 October 2017 7:40
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.

Re: Blockly examples

Posted: Saturday 04 November 2017 7:51
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

Re: Blockly examples

Posted: Saturday 04 November 2017 11:43
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

Re: Blockly examples

Posted: Wednesday 08 November 2017 8:40
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

Re: Blockly examples

Posted: Monday 20 November 2017 23:27
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

Re: Blockly examples

Posted: Thursday 23 November 2017 22:24
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: '

Re: Blockly examples

Posted: Thursday 23 November 2017 22:28
by StanHD
If Rook Alarm = Panic ?

Re: Blockly examples

Posted: Thursday 23 November 2017 22:36
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

Re: Blockly examples

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

This seems to be working.
Smoke_detection_Open_Shutter.png
Smoke_detection_Open_Shutter.png (53.81 KiB) Viewed 14300 times

Re: Blockly examples

Posted: Sunday 26 November 2017 14:50
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 ...

Re: Blockly examples

Posted: Sunday 26 November 2017 18:11
by Hempie
Thank you @tozzke i will test this when i'm home.