Page 30 of 36
Re: Blockly examples
Posted: Monday 01 October 2018 20:38
by shamie
tried to creat a blockly but i cannot make it with some dependancies.
if i turn on my computer i want that my desklight to be turned on, and if i quit computing i want it to turn off, for that i have the following:
and for off:
pretty much straight forward, no big deal and works like a charm.
only i want to extend it that if it is past sunset the light wil go on, otherwise not.
i tried several options like the one below but it doesnt work at all.
what may go wrong and can someone help me out here?
Re: Blockly examples
Posted: Monday 01 October 2018 21:09
by waaren
shamie wrote: ↑Monday 01 October 2018 20:38
tried to creat a blockly but i cannot make it with some dependancies.
if i turn on my computer i want that my desklight to be turned on, and if i quit computing i want it to turn off
I want to extend it that if it is past sunset the light wil go on, otherwise not.
what may go wrong and can someone help me out here?
The Blockly with the check if it is past sunset is not correct.
It will test if the state of the PC is ("On" and time > sunset) This will lead to an unknown comparevariable logic_operation
A correct Blockly is:

- Knipsel.PNG (17.6 KiB) Viewed 4499 times
Re: Blockly examples
Posted: Tuesday 02 October 2018 20:42
by shamie
waaren wrote: ↑Monday 01 October 2018 21:09
shamie wrote: ↑Monday 01 October 2018 20:38
tried to creat a blockly but i cannot make it with some dependancies.
if i turn on my computer i want that my desklight to be turned on, and if i quit computing i want it to turn off
I want to extend it that if it is past sunset the light wil go on, otherwise not.
what may go wrong and can someone help me out here?
The Blockly with the check if it is past sunset is not correct.
It will test if the state of the PC is ("On" and time > sunset) This will lead to an unknown comparevariable logic_operation
A correct Blockly is:
Knipsel.PNG
Thanks for the clarification, it make sense, i must keep in mind that a state is not transfered to another block.
thank you for the help, it works now
Re: Events: Blockly examples
Posted: Tuesday 30 October 2018 9:14
by Himmy
bistoury wrote: ↑Monday 15 July 2013 22:40
My first heating scenario.
I am afraid I will need to dig into LUA...
blocky_heating_19.jpg
Hey there
I saw a post from you from 2013 where you showed a blockly if else-action.
What i found surprising is that your AND components were vertical in stead of horizontal
So it was:
ANS variabel1 in stead of what i always get variabel1 AND variabel2
variabel2
Your vizualisation makes less wide blockly scripts which are better readable. How did you fixed this?
WHI
Re: Events: Blockly examples
Posted: Tuesday 30 October 2018 17:45
by tozzke
Himmy wrote: ↑Tuesday 30 October 2018 9:14
bistoury wrote: ↑Monday 15 July 2013 22:40
My first heating scenario.
I am afraid I will need to dig into LUA...
blocky_heating_19.jpg
Hey there
I saw a post from you from 2013 where you showed a blockly if else-action.
What i found surprising is that your AND components were vertical in stead of horizontal
So it was:
ANS variabel1 in stead of what i always get variabel1 AND variabel2
variabel2
Your vizualisation makes less wide blockly scripts which are better readable. How did you fixed this?
WHI
Right click on the block you want and click 'external inputs'
Re: Blockly examples
Posted: Tuesday 30 October 2018 21:27
by uschuga
This is my first step learning more about blockly and I started with this simple example:

- Domo01.jpg (11.35 KiB) Viewed 4050 times
R02 turned on correctly when P02 was switched on, but R02 did not switched of after 1 minute. Exchanging both switches does not work ether. What went wrong?
Re: Blockly examples
Posted: Tuesday 30 October 2018 22:18
by tozzke
uschuga wrote: ↑Tuesday 30 October 2018 21:27
This is my first step learning more about blockly and I started with this simple example:
Domo01.jpg
R02 turned on correctly when P02 was switched on, but R02 did not switched of after 1 minute. Exchanging both switches does not work ether. What went wrong?
First of all I'd use the single digit blockly and not the time blockly for telling it to turn on for 1 minute.
Secondly you'd like it to turn on for 1 minute and off afterwards... However 'On for x minutes' does just that... turns something on for x minutes, not off afterwards but teels it to go "back" to its previous state. If it was off, it'll turn off but when it was already on, it'll turn "back" on again (check the log of the switch)
I'd use (and make sure the type of event is set to 'Device' to prevent retriggering):
Code: Select all
If [.P02_Switch] = [On]
Do [Set [.R02_1_Licht_Terasse] = [On]]
Do [Set [.R02_1_Licht_Terasse] = [Off] after [60] seconds]
Re: Blockly examples
Posted: Thursday 01 November 2018 21:10
by uschuga
Perfect, now it works well. Thank you!
However, there was another syntax challenge responsible for some other strange observations on my side:
10 seconds = [10:00], not [00:10].
What is the background to set the type of event to "Device"? In which cases the other types are appropriate?
Re: Blockly examples
Posted: Friday 02 November 2018 17:44
by tozzke
Regarding the 10 seconds... that's why I said you'd better
not use the time ([..:..])block for that to prevent unforseen reactions.
When you set your event to 'Device', it'll only trigger on a device change on devices in the if-statement(s), 'Time' will trigger every minute,
link
Re: Blockly examples
Posted: Wednesday 28 November 2018 11:34
by AYAMY
there is a way with blocky to find the lowest and highest temperature in a day ?
thanks
Re: Blockly examples
Posted: Sunday 02 December 2018 12:05
by gtjgtj
Hello everybody.
I'm new to Domoticz and trying to create my first blocky events.
I have connected a ZWave PIR sensor to a porch light which is triggered no problem when motion is detected.
Ideally, I wanted the light to switch on when motion is detected only between sunset and sunrise.
Therefore, I created:
but that wouldn't work.
Should I try something like this?
Any help will be greatly appreciated.
Re: Blockly examples
Posted: Monday 03 December 2018 12:09
by tozzke
gtjgtj wrote: ↑Sunday 02 December 2018 12:05
Hello everybody.
I'm new to Domoticz and trying to create my first blocky events.
I have connected a ZWave PIR sensor to a porch light which is triggered no problem when motion is detected.
Ideally, I wanted the light to switch on when motion is detected only between sunset and sunrise.
Therefore, I created:
but that wouldn't work.
Should I try something like this?
Any help will be greatly appreciated.
The first blockly is the correct way to do it but you'll have to keep in mind that Domoticz time based events only work on the same day (NOT passing midnight). This means that on the same day it can't be later than sunset and simultaniously earlier than sunrise. That condition will always be false.
With this in mind, you'll have to change it to:
I added the 'and [Front Door Light] = [Off]' to prevent retriggering and '[Set [Front Door Light] = [Off] after [60] seconds]' to turn the light off again
Re: Blockly examples
Posted: Monday 03 December 2018 20:34
by gtjgtj
tozzke wrote: ↑Monday 03 December 2018 12:09
gtjgtj wrote: ↑Sunday 02 December 2018 12:05
Hello everybody.
I'm new to Domoticz and trying to create my first blocky events.
I have connected a ZWave PIR sensor to a porch light which is triggered no problem when motion is detected.
Ideally, I wanted the light to switch on when motion is detected only between sunset and sunrise.
Therefore, I created:
but that wouldn't work.
Should I try something like this?
Any help will be greatly appreciated.
The first blockly is the correct way to do it but you'll have to keep in mind that Domoticz time based events only work on the same day (NOT passing midnight). This means that on the same day it can't be later than sunset and simultaniously earlier than sunrise. That condition will always be false.
With this in mind, you'll have to change it to:
I added the 'and [Front Door Light] = [Off]' to prevent retriggering and '[Set [Front Door Light] = [Off] after [60] seconds]' to turn the light off again
Thank you so much for the detailed explanation!
I'm sure now that I understood the logic it works.
However, I set it exactly as you suggested and the light turns on and off periodically on an endless loop!
What am I possibly doing wrong?
Re: Blockly examples
Posted: Monday 03 December 2018 21:12
by gtjgtj
Dear tozzke
I think I got it at last. It seems there was a syntax error in my blockly script.
What I understand is that you have to create the time blocklys first then the ''burglar'' one and then compile them into one line. I was adding blockly by blocky- one by one and that didn't seem to work.
Does that yellow marking when you select the whole blockly show if the complete chain is in effect?
If that's the case, then now when I mark the ''if blockly'' at the beginning of the line it includes all parameters.
The only parameter I have not got to add yet is the one you suggested to prevent retriggering as it keeps failing to include it in the line. However, I think I'll work something out in the end!
Thank you so much. Your response was a ton helpful and to the point!
Re: Blockly examples
Posted: Monday 10 December 2018 18:41
by jimbo213Mo
Hello
Why is this [my first blockly] not working?

- BlocklyTimerFail.jpg (56.56 KiB) Viewed 3424 times
Re: Blockly examples
Posted: Tuesday 11 December 2018 1:46
by waaren
jimbo213Mo wrote: ↑Monday 10 December 2018 18:41
Hello
Why is this [my first blockly] not working?
I am no blockly expert but the blocky below works.

- btr.png (22.17 KiB) Viewed 3415 times
Differences with yours:
Only one If Do block
Time is = hh:mm not >=
Time is entered as hh:mm not hhmm
Scene is set to "On" not "Active"
I am on a recent Beta and cannot choose between Device or Time based blockly but if you can choose, I would go for a time based event.
"your mileage may vary" but this can be a start. Try from here and adjust to see if the blockly keeps working after your changes.
Re: Blockly examples
Posted: Tuesday 11 December 2018 8:45
by sterremos
Hi, i have a mi cube and connected to domoticz, i have make a program to change the light to 4 different colours if i turn the cube. make four scene with the colours ,red, green, white and yellow.
After the last turn (yellow) the program has to go on the first scene again (red)
Now its stucks at the last one, can someone give me the clue how the make the loop?
RJ
Re: Blockly examples
Posted: Thursday 13 December 2018 14:44
by RobbieT
I'm trying to create a simple blockly that plays a "doorbell" sound when my front door is open:
This is what I currently have, but nothing happens, what am I doing wrong?
Re: Blockly examples
Posted: Thursday 13 December 2018 18:47
by tozzke
RobbieT wrote: ↑Thursday 13 December 2018 14:44
I'm trying to create a simple blockly that plays a "doorbell" sound when my front door is open:
This is what I currently have, but nothing happens, what am I doing wrong?
And that's strange because...?
presuming that's the right command for the Xiaomi gateway to make a sound, you're telling it to play at volume ?10%? after 5 minutes but turn it off again after only 5 seconds. It'll never go to that 10% because you're telling it to go off before it even turns to 10%
Re: Blockly examples
Posted: Thursday 13 December 2018 20:32
by RobbieT
tozzke wrote: ↑Thursday 13 December 2018 18:47
RobbieT wrote: ↑Thursday 13 December 2018 14:44
I'm trying to create a simple blockly that plays a "doorbell" sound when my front door is open:
This is what I currently have, but nothing happens, what am I doing wrong?
And that's strange because...?
presuming that's the right command for the Xiaomi gateway to make a sound, you're telling it to play at volume ?10%? after 5 minutes but turn it off again after only 5 seconds. It'll never go to that 10% because you're telling it to go off before it even turns to 10%
According to the Xiaomi gateway Wiki (
https://wiki.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)) the "level" is for selecting the sound that has to be played. I will set the time to off a bit longer, see what happens.