Page 17 of 36
Re: Blockly examples
Posted: Monday 17 October 2016 20:21
by BartdaMan
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/
Re: Blockly examples
Posted: Thursday 20 October 2016 18:14
by bacinatorz
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/
Thnx for your clear screenshot, I have done this and now it works!
Re: Blockly examples
Posted: Sunday 23 October 2016 10:45
by mAiden88
Here my example..
But it dont works got a error..
Re: Blockly examples
Posted: Sunday 23 October 2016 12:15
by Derik
Dear All..
Is there someone that the OTG integrated in Blockley..
I do have a simple test, that is not working..:
- ScreenShot074.jpg (67.36 KiB) Viewed 3094 times
Do i something wrong.?
Or is OTG not integrated in Blockley..?
..
Re: Blockly examples
Posted: Sunday 06 November 2016 23:27
by delfisastre
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
- blockly.jpeg (53.21 KiB) Viewed 3000 times
Re: Blockly examples
Posted: Monday 07 November 2016 0:41
by Derik
looks the actual i not working?
Strange perhaps some that make the blockley can fix this..[ gizmocuz not i believe ]
Re: Blockly examples
Posted: Monday 07 November 2016 21:09
by delfisastre
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!
Re: Blockly examples
Posted: Monday 07 November 2016 22:06
by ztocken
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'
- blockly.PNG (17.89 KiB) Viewed 2947 times
Anyone have a suggestion?
Re: Blockly examples
Posted: Monday 07 November 2016 23:06
by geezerrr
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'
blockly.PNG
Anyone have a suggestion?
[Sunset = on] isn't a correct statement.
Maybe you can change it in [time >= sunset]
Re: Blockly examples
Posted: Tuesday 08 November 2016 7:20
by StanHD
Also that's the wrong block for minutes. Try using the number block not a time block.
Re: Blockly examples
Posted: Wednesday 09 November 2016 21:30
by bjacobse
Ztocken,
This blockly is working with sunset and minutes, use as guide/inspiration
- blockly.png (36.12 KiB) Viewed 2887 times
Re: Blockly examples
Posted: Monday 14 November 2016 11:45
by bonterra
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?
Re: Blockly examples
Posted: Monday 14 November 2016 12:21
by emme
a LUA Device Script could help, but you have to use a variable:
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
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
Re: Blockly examples
Posted: Monday 14 November 2016 12:29
by four2six
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'
Re: Blockly examples
Posted: Monday 14 November 2016 17:06
by sailmich
@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
Re: Blockly examples
Posted: Tuesday 15 November 2016 9:23
by four2six
sailmich 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.
not with my solution
Re: Blockly examples
Posted: Tuesday 15 November 2016 17:26
by bonterra
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'
Thanks, I might go for something like this.
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
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.
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)...
Re: Blockly examples
Posted: Tuesday 15 November 2016 22:13
by sailmich
Re: Blockly examples
Posted: Tuesday 15 November 2016 23:03
by HBrandt
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
Re: Blockly examples
Posted: Wednesday 16 November 2016 6:55
by sailmich
@HBrandt , could you please convert my blockly into one with variables. So I could see how it looks.
Thx
Regards