Blockly examples
Moderator: leecollings
- BartdaMan
- Posts: 20
- Joined: Sunday 22 May 2016 22:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Amersfoort
- Contact:
Re: Blockly examples
Bacinatorz,
You can solve this by adding a variable that changes state when the script runs. This way the script only triggers your Ledstrip once.
Here's an example:
https://postimg.org/image/k0dead18r/
You can solve this by adding a variable that changes state when the script runs. This way the script only triggers your Ledstrip once.
Here's an example:
https://postimg.org/image/k0dead18r/
-
- Posts: 2
- Joined: Saturday 08 October 2016 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Thnx for your clear screenshot, I have done this and now it works!BartdaMan wrote:Bacinatorz,
You can solve this by adding a variable that changes state when the script runs. This way the script only triggers your Ledstrip once.
Here's an example:
https://postimg.org/image/k0dead18r/
- mAiden88
- Posts: 56
- Joined: Friday 14 October 2016 22:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.7286
- Location: Almelo
- Contact:
Re: Blockly examples
Here my example..
But it dont works got a error..
But it dont works got a error..
Anyone can build a fast processor. The trick is to build a fast system.
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Blockly examples
Dear All..
Is there someone that the OTG integrated in Blockley..
I do have a simple test, that is not working..: Do i something wrong.?
Or is OTG not integrated in Blockley..?
..
Is there someone that the OTG integrated in Blockley..
I do have a simple test, that is not working..: Do i something wrong.?
Or is OTG not integrated in Blockley..?
..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 18
- Joined: Wednesday 05 October 2016 11:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Catalonia, Barcelona
- Contact:
Re: Blockly examples
I need your help!
I don't know why is not working.
I have a motion sensor in the room, and I want to swicht off the light if the sensor detects no mottion. But the problem is, If I'm wathcing the TV, sometimes, the lights turn off, because the sensor don't detects motion. And put in a blockly. If detects no motion, but the TV is ON. Don't turn off the lights. But! the TV only is OFF is it's completly stops. (no with stantd by) and I put in the blockly if the electrical consumption to the TV is less than 20w ant no detects motion. Turn off the lights... But is not working.
Presencia Menjador = Motion Sensor
Tv = TV
Consum Actual TV = actual electrical consumption TV
Mnejador1 = Light 1
Menjador 2= Light 2
I don't know why is not working.
I have a motion sensor in the room, and I want to swicht off the light if the sensor detects no mottion. But the problem is, If I'm wathcing the TV, sometimes, the lights turn off, because the sensor don't detects motion. And put in a blockly. If detects no motion, but the TV is ON. Don't turn off the lights. But! the TV only is OFF is it's completly stops. (no with stantd by) and I put in the blockly if the electrical consumption to the TV is less than 20w ant no detects motion. Turn off the lights... But is not working.
Presencia Menjador = Motion Sensor
Tv = TV
Consum Actual TV = actual electrical consumption TV
Mnejador1 = Light 1
Menjador 2= Light 2
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Blockly examples
looks the actual i not working?
Strange perhaps some that make the blockley can fix this..[ gizmocuz not i believe ]
Strange perhaps some that make the blockley can fix this..[ gizmocuz not i believe ]
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 18
- Joined: Wednesday 05 October 2016 11:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Catalonia, Barcelona
- Contact:
Re: Blockly examples
I don't know why.... but now it's working!!! maybe is the cache of the browser... I don't know. But works perfectly. Thanks for your help!
-
- Posts: 3
- Joined: Tuesday 19 January 2016 10:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
I could use some help with my blockly event.
my devices:
rörelsesensor framsidan = motion sensor outside front of house
Entre = porch lamp
hallen = lamp hallway inside of house.
what i want to do:
if its dark outside i want the porch lamp (Entre) and the hallway lamp (hallen) to turn on for 5 minutes if there is movement outside.
But only if the porch lamp is not already on.
what happends is i get this error:
2016-11-07 21:51:29.319 Error: EventSystem: Lua script error (Blockly), Name: auto lampa framsida_1 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: ')' expected near 'comparevariable'
Anyone have a suggestion?
my devices:
rörelsesensor framsidan = motion sensor outside front of house
Entre = porch lamp
hallen = lamp hallway inside of house.
what i want to do:
if its dark outside i want the porch lamp (Entre) and the hallway lamp (hallen) to turn on for 5 minutes if there is movement outside.
But only if the porch lamp is not already on.
what happends is i get this error:
2016-11-07 21:51:29.319 Error: EventSystem: Lua script error (Blockly), Name: auto lampa framsida_1 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: ')' expected near 'comparevariable'
Anyone have a suggestion?
-
- Posts: 79
- Joined: Tuesday 02 December 2014 22:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Blockly examples
[Sunset = on] isn't a correct statement.ztocken wrote:I could use some help with my blockly event.
my devices:
rörelsesensor framsidan = motion sensor outside front of house
Entre = porch lamp
hallen = lamp hallway inside of house.
what i want to do:
if its dark outside i want the porch lamp (Entre) and the hallway lamp (hallen) to turn on for 5 minutes if there is movement outside.
But only if the porch lamp is not already on.
what happends is i get this error:
2016-11-07 21:51:29.319 Error: EventSystem: Lua script error (Blockly), Name: auto lampa framsida_1 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: ')' expected near 'comparevariable'
Anyone have a suggestion?
Maybe you can change it in [time >= sunset]
- StanHD
- Posts: 347
- Joined: Friday 12 July 2013 16:09
- Target OS: Windows
- Domoticz version:
- Location: East Sussex, UK
- Contact:
Re: Blockly examples
Also that's the wrong block for minutes. Try using the number block not a time block.
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
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
-
- Posts: 85
- Joined: Tuesday 06 September 2016 9:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Sorø, DK
- Contact:
Re: Blockly examples
Ztocken,
This blockly is working with sunset and minutes, use as guide/inspiration
This blockly is working with sunset and minutes, use as guide/inspiration
-
- Posts: 6
- Joined: Wednesday 19 October 2016 13:53
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Blockly examples
I hope someone can help me. I've got a door sensor and a Qubino relay module installed to control a lamp inside my front door. The same light is also connected to a traditional switch for manual control. Door switch is "ON" when the door is open and "OFF" when the door is closed.
I would like to have two separate events, entry and exit. If the lamp is off and the door opens, turn it on for five minutes (entry). If the lamp is on and the door opens, turn it off after two minutes (exit). Both events are very simple but I just can't get them to work together.
I guess I need a dummy switch to separate these two events somehow?
I would like to have two separate events, entry and exit. If the lamp is off and the door opens, turn it on for five minutes (entry). If the lamp is on and the door opens, turn it off after two minutes (exit). Both events are very simple but I just can't get them to work together.
I guess I need a dummy switch to separate these two events somehow?
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Blockly examples
a LUA Device Script could help, but you have to use a variable:
Variable named: DOOROPERATION - string(1)
1 = ENTRY
2 = EXIT
0 = INOP
this should works...
Be aware that the uservariable determinates IF an operation is on going on the door... this means that for 2 minutes no action will be taken
There is not a real reason to set the variable to 1 or 2... since it tests only if it is 0 to run (but.. maybe just for debug information)
ciao
M
Variable named: DOOROPERATION - string(1)
1 = ENTRY
2 = EXIT
0 = INOP
Code: Select all
commandArray {}
if devicechanged['DoorSwitchName'] or devicechanged['extLampName'] then
if otherdevices['extLampName'] == 'Off' and otherdevices['DoorSwitchName'] == 'Off' and uservariables['DOOROPERATION'] = '0' then -- ENTRY
commandarray['variable:DOOROPERATION'] = '1'
commandArray['extLampName'] = 'On FOR 5'
elseif otherdevices['extLampName'] == 'On' and otherdevices['DoorSwitchName'] == 'Off' and uservariables['DOOROPERATION'] = '0' then -- EXIT
commandarray['variable:DOOROPERATION'] = '2'
commandArray['extLampName'] = 'Off AFTER 2'
end
commandarray['variable:DOOROPERATION'] = '0 AFTER 2'
end
return commandArray
Be aware that the uservariable determinates IF an operation is on going on the door... this means that for 2 minutes no action will be taken
There is not a real reason to set the variable to 1 or 2... since it tests only if it is 0 to run (but.. maybe just for debug information)
ciao
M
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
I'd try virtual switches, one called 'entry', one 'exit'.
which leads to:
if 'entry' = 'off' and exit 'off' and 'door' = 'on' and 'lamp' = 'on'
set 'exit' = 'on' for 2 minutes
if 'entry' = 'off' and exit 'off' and 'door' = 'on' and 'lamp' = 'off'
set 'entry' = 'on' for 5 minutes
if 'entry' = 'on' or 'exit = 'on'
set 'lamp' = 'on'
if 'entry' = 'off' and 'exit = 'off'
set 'lamp' = 'off'
which leads to:
if 'entry' = 'off' and exit 'off' and 'door' = 'on' and 'lamp' = 'on'
set 'exit' = 'on' for 2 minutes
if 'entry' = 'off' and exit 'off' and 'door' = 'on' and 'lamp' = 'off'
set 'entry' = 'on' for 5 minutes
if 'entry' = 'on' or 'exit = 'on'
set 'lamp' = 'on'
if 'entry' = 'off' and 'exit = 'off'
set 'lamp' = 'off'
-
- Posts: 232
- Joined: Wednesday 17 February 2016 22:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Germany
- Contact:
Re: Blockly examples
@bonterra I tried with success what you want to do. See attachment.
Problem with that is if you changed your mind, for example you have forgotten something inside and you are open the door inside the 120 seconds, you will start the 5 minutes. At least in my opinion you need a PIR sensor inside your room to make the system running perfect.
regards
Problem with that is if you changed your mind, for example you have forgotten something inside and you are open the door inside the 120 seconds, you will start the 5 minutes. At least in my opinion you need a PIR sensor inside your room to make the system running perfect.
regards
- Attachments
-
- Bildschirmfoto vom 2016-11-14 16-19-41.png (23.4 KiB) Viewed 2767 times
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
not with my solutionsailmich wrote:Problem with that is if you changed your mind, for example you have forgotten something inside and you are open the door inside the 120 seconds, you will start the 5 minutes.
-
- Posts: 6
- Joined: Wednesday 19 October 2016 13:53
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Blockly examples
Thanks, I might go for something like this.four2six wrote:I'd try virtual switches, one called 'entry', one 'exit'.
which leads to:
if 'entry' = 'off' and exit 'off' and 'door' = 'on' and 'lamp' = 'on'
set 'exit' = 'on' for 2 minutes
if 'entry' = 'off' and exit 'off' and 'door' = 'on' and 'lamp' = 'off'
set 'entry' = 'on' for 5 minutes
if 'entry' = 'on' or 'exit = 'on'
set 'lamp' = 'on'
if 'entry' = 'off' and 'exit = 'off'
set 'lamp' = 'off'
A PIR would be ideal, then it wouldn't matter if the door was opened twice during the active minutes. I'll have a look and see what I can find.sailmich wrote:@bonterra I tried with success what you want to do. See attachment.
Problem with that is if you changed your mind, for example you have forgotten something inside and you are open the door inside the 120 seconds, you will start the 5 minutes. At least in my opinion you need a PIR sensor inside your room to make the system running perfect.
regards
Thanks for your help, both of you!
Now I just have to figure out why I can't control the second channel of the Qubino (porch light) from the wall switch, it's wired just like the first channel (indoor light)...
-
- Posts: 232
- Joined: Wednesday 17 February 2016 22:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Germany
- Contact:
Re: Blockly examples
@four2six, virtual switches are fantastic. I tried as you wrote in one block but it doesn't work. With three it works.
regards
I should more often create virtual switches regards
Re: Blockly examples
Could these virtual switches not be converted to variables? I find it confusing with all these virtual switches and if they are only used to hold on/off state it seems to be overkill.
Mvh Henrik
Mvh Henrik
-
- Posts: 232
- Joined: Wednesday 17 February 2016 22:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Germany
- Contact:
Re: Blockly examples
@HBrandt , could you please convert my blockly into one with variables. So I could see how it looks.
Thx
Regards
Thx
Regards
Who is online
Users browsing this forum: No registered users and 1 guest