Blockly examples
Moderator: leecollings
-
- Posts: 2
- Joined: Saturday 22 April 2017 16:53
- Target OS: Linux
- Domoticz version: 3.7450
- Location: finland
- Contact:
Re: Blockly examples
newbie here...
now i have problem, event do nothing...
and its easy block event
i try change 24 > 24.1 temp set point, fibaro motion sensor gives 23.7 out, fan doest go off, no log write...
fibaro motion sensor and fibaro dual relay, ubuntu
now i have problem, event do nothing...
and its easy block event
i try change 24 > 24.1 temp set point, fibaro motion sensor gives 23.7 out, fan doest go off, no log write...
fibaro motion sensor and fibaro dual relay, ubuntu
- Attachments
-
- mh1fanoff.tiff (33.99 KiB) Viewed 7840 times
-
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Blockly examples
So finally i have done all my blocky scripts... Check the different blocky configs.
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Blockly examples
Here last 3 ones
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
- Posts: 20
- Joined: Tuesday 20 June 2017 13:46
- Target OS: Linux
- Domoticz version: 4.10007
- Contact:
Re: Blockly examples
Morning folks...
I'm having some issue with a blockly which does a bit more than needed. Situation is, I've got a dummy which tells if it's dark or not (IsDonker) and a dummy which tells if someone's home (SomeoneHome).
What I want to accomplish is the hallway light turning on for 5 minutes when it's dark and someone comes home. This blockly does exactly that, but it also turns the light on for 5 minutes when someone is home and it gets dark. I only want it to trigger on someone coming home in the dark, not when we're already at home. I'm starting to get the feeling I can only do that in a script since blockly triggers on all device changes.
So, can it be done in blockly? Or should I really brush up my LUA knowledge?
I'm having some issue with a blockly which does a bit more than needed. Situation is, I've got a dummy which tells if it's dark or not (IsDonker) and a dummy which tells if someone's home (SomeoneHome).
What I want to accomplish is the hallway light turning on for 5 minutes when it's dark and someone comes home. This blockly does exactly that, but it also turns the light on for 5 minutes when someone is home and it gets dark. I only want it to trigger on someone coming home in the dark, not when we're already at home. I'm starting to get the feeling I can only do that in a script since blockly triggers on all device changes.
So, can it be done in blockly? Or should I really brush up my LUA knowledge?
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
I'm sure the answer is yes to both questions
what's the difference between 'HallwayOn' and 'Lamp Halway'. One being a group of Lights?
edit:
and how do you know someone is coming home?
what's the difference between 'HallwayOn' and 'Lamp Halway'. One being a group of Lights?
edit:
and how do you know someone is coming home?
-
- Posts: 20
- Joined: Tuesday 20 June 2017 13:46
- Target OS: Linux
- Domoticz version: 4.10007
- Contact:
Re: Blockly examples
HallwayOn is a dummy switch to register if the light has been turned on before. Else the lights would just go off and on again after 5 minutes, since the conditions haven't changed. Lamp Hal is the fibaro switch that switches the physical lamp.
SomeoneHome is a dummy switch that is turned on when either my phone or my girlfriends phone is online on our wifi network. Using the presence detection script from the wiki.
SomeoneHome is a dummy switch that is turned on when either my phone or my girlfriends phone is online on our wifi network. Using the presence detection script from the wiki.
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
ok.
I'm not sure the Lamp Hallway switch would go on again, if you wouldn't use that HallwayOn dummy switch.
You enter the home, the SomeoneHome dummy switch changes from Off to On. That triggers the action.
Have you tried a simple
?
In my experience "If SomeoneHome = On" doesn't mean what it says (always check if someone is home and if so, do what is stated) but it means once the status of SomeoneHome switches to On, do what is stated. I might be wrong, but give it a try.
Of course i don't know how often SomeoneHome switches during the night for other reasons (system changes, phones go off, etc)... if that's the case you'd have to work with a dummy switch somehow.
I'm not sure the Lamp Hallway switch would go on again, if you wouldn't use that HallwayOn dummy switch.
You enter the home, the SomeoneHome dummy switch changes from Off to On. That triggers the action.
Have you tried a simple
Code: Select all
If SomeoneHome = On and IsDonker = On
set LampHal = On for 5 Minutes
In my experience "If SomeoneHome = On" doesn't mean what it says (always check if someone is home and if so, do what is stated) but it means once the status of SomeoneHome switches to On, do what is stated. I might be wrong, but give it a try.
Of course i don't know how often SomeoneHome switches during the night for other reasons (system changes, phones go off, etc)... if that's the case you'd have to work with a dummy switch somehow.
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
ok, i forgot this will turn on once it gets dark and someone is home. so you need a dummy switch. sorry. this was your original problem.
try
try
Code: Select all
If SomeoneHome = Off and IsDonker = On
Set HallwayOn = On
Else If IsDonker = Off
set HallwayOn = Off
Else If SomeoneHome = On and HallwayOn = On
set LampHal = On for 5 Minutes
-
- Posts: 20
- Joined: Tuesday 20 June 2017 13:46
- Target OS: Linux
- Domoticz version: 4.10007
- Contact:
Re: Blockly examples
That might tackle my current problem, but... doesn't this mean my light will never turn off again? After 5 minutes those conditions will still be true, so the light will immediately turn on again. I think I'd need yet another switch for this...
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
i don't think this will turn the light back on. as i said above, it doesn't check both if-parts for being true, but it checks if the whole if-block turns (!) true. as long as you don't leave home and SomeoneHome is turned to off and you enter your home again and SomeoneHome turns back to On, the light shouldn't switch on. And this seems to be exactly what you want. Give it a try.
-
- Posts: 20
- Joined: Tuesday 20 June 2017 13:46
- Target OS: Linux
- Domoticz version: 4.10007
- Contact:
Re: Blockly examples
Hmm, you're right. I wonder why the light kept turning back on yesterday. <ight have to rename the dummy though, it's functionality isn't really matching it's use like this
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
name it HallwayArmed
-
- Posts: 20
- Joined: Tuesday 20 June 2017 13:46
- Target OS: Linux
- Domoticz version: 4.10007
- Contact:
Re: Blockly examples
Well, I'll leave it as is for the moment since... it still turns the hallway lights on at sundown when we're already home. So your suggestion seems to have the exact same outcome as my own blockly
Thought I really don't understand why it happened yet.
Edit:
Figured it out. Had an error in the first if [SomeoneHome = On] instead of Off. But it wouldn't work if I tested it after I corrected the error... But I figure that's because the 5 minutes for the previous trigger hadn't run out. It seems you can't trigger that event again during the "for X minutes" cycle. I'll have to wait till tonight for a live test, but it appears to work.
Thought I really don't understand why it happened yet.
Edit:
Figured it out. Had an error in the first if [SomeoneHome = On] instead of Off. But it wouldn't work if I tested it after I corrected the error... But I figure that's because the 5 minutes for the previous trigger hadn't run out. It seems you can't trigger that event again during the "for X minutes" cycle. I'll have to wait till tonight for a live test, but it appears to work.
-
- Posts: 39
- Joined: Tuesday 11 July 2017 10:26
- Target OS: NAS (Synology & others)
- Domoticz version: 2020.2
- Location: Germany
- Contact:
Re: Blockly examples
Letalis wrote:... Can you get blocky to only send notification once?
Do not know, if you both solved your problem already, but nevertheless wanted to share my solution with you and all new Blockly users.kurniawan77 wrote: ... Is there some way that i can cancel the timer? ...
If you want to stop an action, e.g. sending a message or notification, but also stopping to trigger something, e.g roller shutter getting in a defined postition, you need to include an own user variable, which needs to be defined seperately. This variable needs to be checked in the beginning (if) and needs to be changed in the end (then do change) e.g. from 0 to 1.
But do not forget to write a sepaerate Blockly to reset the user variable to 0 again. Otherwise your Blockly event will not be triggered again, since the Blockly script checks the variable in the beginning (should be 0).
Kind regards
matty
Domoticz Beta | Aeon Labs Z-Wave USB Stick Gen5 | Cyrus SmartHome 4-in-1 Multisensor | Qubino ZMNHCD1 - Roller Shutter | NEO COOLCAM NAS-WR01ZE Power Plug | Fibaro FGRGB-101 | WEMOS D1 MINI (ESP8266) Sensors CO2/TEMP/BARO |
-
- Posts: 39
- Joined: Tuesday 11 July 2017 10:26
- Target OS: NAS (Synology & others)
- Domoticz version: 2020.2
- Location: Germany
- Contact:
Re: Blockly examples
One more thing I wanted to share, since I found this mistake after three days of testing ... could save some time for other people.
While trying to write a Blocky script for closing and opening my roller/shutter it was not working. The event was finally triggered, I have got my notifcation message but the roller/shutter position did not change. I triggered to open or to close the roller/shutter and this was my mistake. Since my Qubino shutter switch is configured with percentage you need to use set to percentage 0 or 100. Then will wok. Therefore, always look carefully at your switches when writing some Blockly scripts..
Kind regards
While trying to write a Blocky script for closing and opening my roller/shutter it was not working. The event was finally triggered, I have got my notifcation message but the roller/shutter position did not change. I triggered to open or to close the roller/shutter and this was my mistake. Since my Qubino shutter switch is configured with percentage you need to use set to percentage 0 or 100. Then will wok. Therefore, always look carefully at your switches when writing some Blockly scripts..
Kind regards
Domoticz Beta | Aeon Labs Z-Wave USB Stick Gen5 | Cyrus SmartHome 4-in-1 Multisensor | Qubino ZMNHCD1 - Roller Shutter | NEO COOLCAM NAS-WR01ZE Power Plug | Fibaro FGRGB-101 | WEMOS D1 MINI (ESP8266) Sensors CO2/TEMP/BARO |
- sisaenkov
- Posts: 50
- Joined: Friday 27 May 2016 7:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8
- Location: Moscow, Russia
- Contact:
Re: Blockly examples
Hello.
I've got pressure sensors like this one: And I can't get such event working: I have also tried using String field for pressure value.
Works only "not equal" type.
I've got pressure sensors like this one: And I can't get such event working: I have also tried using String field for pressure value.
Works only "not equal" type.
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
some first thoughts: why is the notification subject empty?
did you try it without the notification?
is the value of the pressure sensor above 1 and then changes to below 1? or is it below 1 all the time?
did you try it without the notification?
is the value of the pressure sensor above 1 and then changes to below 1? or is it below 1 all the time?
- sisaenkov
- Posts: 50
- Joined: Friday 27 May 2016 7:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8
- Location: Moscow, Russia
- Contact:
Re: Blockly examples
1. Subject is unnecessary for Telegram notifications.
2. Yes, I tried.
3. At that moment value of pressure sensor was 0.
Unfortunately blocky doesn't work correctly with pressure sensors' value.
As a result I decide to write this logic with LUA:
2. Yes, I tried.
3. At that moment value of pressure sensor was 0.
Unfortunately blocky doesn't work correctly with pressure sensors' value.
As a result I decide to write this logic with LUA:
Code: Select all
if (otherdevices['ColdWaterAvail'] == "On" and otherdevices_svalues['CWPressureSensor'] <= "0.5") then
commandArray['ColdWaterAvail'] = 'Off'
print('CW Pressure is: ' ..otherdevices_svalues['CWPressureSensor'])
end
-
- Posts: 53
- Joined: Wednesday 24 February 2016 9:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NRW, Germany
- Contact:
Re: Blockly examples
blockly has a problem, if both 'and' conditions are already fulfilled. i'd guess it would work if one of them becomes true after you start the testing. LUA is definitely safer.
-
- Posts: 94
- Joined: Monday 30 November 2015 16:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
I am working on my blockly alarm.
I have a BeNext tag reader, which can only be switched with tags.
The tagreader is located at the backdoor, but i'd like to use an virtual switch to manually turn on and off my alarm.
Now i have this:
My problem then is, that when i switch the virtual one, it is the same rule as when i turn off the benext tagreader.
i can overrule the virtual switch, but i cannot overrule the tagreader.
How can i manage this?
I have a BeNext tag reader, which can only be switched with tags.
The tagreader is located at the backdoor, but i'd like to use an virtual switch to manually turn on and off my alarm.
Now i have this:
My problem then is, that when i switch the virtual one, it is the same rule as when i turn off the benext tagreader.
i can overrule the virtual switch, but i cannot overrule the tagreader.
How can i manage this?
Who is online
Users browsing this forum: No registered users and 1 guest