Blockly examples
Moderator: leecollings
-
- Posts: 8
- Joined: Wednesday 20 June 2018 22:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
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?
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?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Blockly examples
The Blockly with the check if it is past sunset is not correct.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?
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:
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 8
- Joined: Wednesday 20 June 2018 22:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Thanks for the clarification, it make sense, i must keep in mind that a state is not transfered to another block.waaren wrote: ↑Monday 01 October 2018 21:09The Blockly with the check if it is past sunset is not correct.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?
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
thank you for the help, it works now
-
- Posts: 4
- Joined: Wednesday 24 January 2018 22:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Contact:
Re: Events: Blockly examples
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
-
- Posts: 135
- Joined: Friday 02 January 2015 9:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands
- Contact:
Re: Events: Blockly examples
Right click on the block you want and click 'external inputs'Himmy wrote: ↑Tuesday 30 October 2018 9:14Hey 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
-
- Posts: 19
- Joined: Friday 26 October 2018 17:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Germany
- Contact:
Re: Blockly examples
This is my first step learning more about blockly and I started with this simple example:
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?
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?
Used Z-Wave devices: EUR_SPIRITZ, FGBS001, FGR223, FGS223, FGBS222, ZMNHYD1 Smart Plug 16A, ZWA009 AërQ Sensor, NAS-WR01Z Power plug 12A, ZME_WALLC-S, FGD212, ST812 Flood Detector, PAN04-1 Double Relay Switch, ZMNHND1 Flush 1D relay, ZME_UZB1 USB Stick
-
- Posts: 135
- Joined: Friday 02 January 2015 9:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands
- Contact:
Re: Blockly examples
First of all I'd use the single digit blockly and not the time blockly for telling it to turn on for 1 minute.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?
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]
-
- Posts: 19
- Joined: Friday 26 October 2018 17:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Germany
- Contact:
Re: Blockly examples
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?
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?
Used Z-Wave devices: EUR_SPIRITZ, FGBS001, FGR223, FGS223, FGBS222, ZMNHYD1 Smart Plug 16A, ZWA009 AërQ Sensor, NAS-WR01Z Power plug 12A, ZME_WALLC-S, FGD212, ST812 Flood Detector, PAN04-1 Double Relay Switch, ZMNHND1 Flush 1D relay, ZME_UZB1 USB Stick
-
- Posts: 135
- Joined: Friday 02 January 2015 9:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands
- Contact:
Re: Blockly examples
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
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
-
- Posts: 21
- Joined: Sunday 27 May 2018 11:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
there is a way with blocky to find the lowest and highest temperature in a day ?
thanks
thanks
-
- Posts: 8
- Joined: Sunday 02 December 2018 11:36
- Target OS: NAS (Synology & others)
- Domoticz version: 3.1 OMV
- Contact:
Re: Blockly examples
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.
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.
-
- Posts: 135
- Joined: Friday 02 January 2015 9:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands
- Contact:
Re: Blockly examples
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.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.
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
-
- Posts: 8
- Joined: Sunday 02 December 2018 11:36
- Target OS: NAS (Synology & others)
- Domoticz version: 3.1 OMV
- Contact:
Re: Blockly examples
tozzke wrote: ↑Monday 03 December 2018 12:09The 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.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.
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?
-
- Posts: 8
- Joined: Sunday 02 December 2018 11:36
- Target OS: NAS (Synology & others)
- Domoticz version: 3.1 OMV
- Contact:
Re: Blockly examples
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!
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!
-
- Posts: 8
- Joined: Friday 26 October 2018 21:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: United States
- Contact:
Re: Blockly examples
Hello
Why is this [my first blockly] not working?
Why is this [my first blockly] not working?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Blockly examples
I am no blockly expert but the blocky below works.
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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Re: Blockly examples
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
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
-
- Posts: 135
- Joined: Friday 02 January 2015 9:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands
- Contact:
Re: Blockly examples
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%
-
- Posts: 17
- Joined: Thursday 13 December 2018 14:34
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Blockly examples
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.tozzke wrote: ↑Thursday 13 December 2018 18:47And 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%
Who is online
Users browsing this forum: No registered users and 1 guest