Page 7 of 36
Re: Blockly examples
Posted: Saturday 13 December 2014 12:30
by Bramz
Korrel wrote:I would to like to automate pomping water through my solar heating panel whenever the sun is clearly shining / heating so i tried the attached event ... (sun is on the solar panels between 11:00 and 16:00)
However, the UVI comparison never works, anyone a idea how to fix this ?
Not that it helps solving your UV-problem but shouldn't you add:
Else Zwembadpomp = Off ?
Otherwise the pump will never shut off once it has been turned on.
Re: Blockly examples
Posted: Sunday 14 December 2014 20:34
by Heisenberg
I can't get this Blocky to work. The radio doesn't play but the lights do turn on. Can someone point me into the right direction?
Re: Blockly examples
Posted: Tuesday 16 December 2014 10:28
by ThinkPad
Heisenberg wrote:I can't get this Blocky to work. The radio doesn't play but the lights do turn on. Can someone point me into the right direction?
Radio should work, just like the lights. But you should also include a check if the device is off. Otherwise Domoticz will keep sending the 'on' command to the Radio and LED kitchen light as long as the PIR is on.
Make it like this:
Code: Select all
IF PIRKitchen = On AND LED Kitchen Light = Off
DO SET LED Kitchen Light = On FOR 2 Minutes
ELSE IF Sensor cabinet = Open AND LED Cabinet = Off
DO SET LED Cabinet On FOR 1 minutes
This decreases CPU load and also pollution on the 433Mhz band (otherwise Domoticz will keep sending the 'On' commands like i said).
-------------------------------------------------------------------------------------------------------------------------------------
Smart event for Christmas tree
I created an event to control my christmas tree:
It can be found here:
https://tweakers.net/ext/f/Pa6OVCMLk0Vr ... E/full.png (too large to embed in this post

)
mirror:
http://i.imgur.com/kftAurC.png
What it does:
Turns the christmas tree on IF:
- There is someone home (based on this: http://www.domoticz.com/forum/viewtopic ... 100#p27521 )
AND
- Time between 06:20 and sunrise AND it is NOT saturday or sunday (we are sleeping longer in the weekend, waking up when it is already light)
OR - Time between sunset and 21:00 (If we come home after 21:00 it won't turn on)
The user variable is added so that the tree can be turned off by hand, otherwise it would turn on again directly after you have turned it off.
The piece with '>21:00' that is connected to the orange part is for turning the tree off when we go to bed (the two lights mentioned in that part are always on when it is evening and we are home).
Important:If you want to change the '21:00' you have to change it in all the places where it is used in the event. Otherwise the event will go into an endless loop (and the tree wil go *on* *off* *on* *off* *on* *off* *on* *off*)
The time can only be changed to times of the current day (so 23:59 works, but 00:01 not), otherwise Domoticz cannot understand the times in combination with the sunrise/sunset
The christmas tree will turn off if you leave home, or if it is dawn (light outside)
Re: Blockly examples
Posted: Saturday 20 December 2014 13:14
by Heisenberg
Make it like this:
Code: Select all
IF PIRKitchen = On AND LED Kitchen Light = Off
DO SET LED Kitchen Light = On FOR 2 Minutes
ELSE IF Sensor cabinet = Open AND LED Cabinet = Off
DO SET LED Cabinet On FOR 1 minutes
This decreases CPU load and also pollution on the 433Mhz band (otherwise Domoticz will keep sending the 'On' commands like i said).
Hi, thanks for the tip! I changed it and now the Radio and Kitchen Light do turn on but the LAMP Cabinet doesn't

I don't understand why. Also I change the name of some sensors. I don't think that's an issue.
EDIT: I got it working again with this Blocky.
Re: Blockly examples
Posted: Monday 29 December 2014 22:48
by deennoo
Hello.
I Use Ula Script to ping a internet box on my second home (a place where we got a lot of electric shut down), actually, when there is some network error, i got some mail (using notification.
I want to use Blocky with the If Do Else.
i can't find the duration value :
ex : if box is off more than 5 minutes then send mail, when box return on send mail.
is this possible ?
Re: Blockly examples
Posted: Monday 19 January 2015 14:49
by Bernd
Hi,
How do I get an Else If ?
I tried a lot but so far not good .....
I see no difference in functionality between the blockies If-Do and the one Else-If-Do
Thank you,
Bernd
Re: Blockly examples
Posted: Monday 19 January 2015 15:52
by Domosapiens
Re: Blockly examples
Posted: Monday 19 January 2015 20:07
by Bernd
Aha, how unlogic. But it works ......
THANKS!
Re: Blockly examples
Posted: Tuesday 27 January 2015 8:31
by superczar
I am using a blockly to send a notification on Prowl if motion is detected and time is during office hours
Is there any way to hold off notifications for a fixed time period (say 5 minutes) after a notification has been triggered?
However, the way my motion sensor is setup, it returns a on/off state every few seconds and thus I invariably end up getting multiple alerts for the same physical event
Re: Blockly examples
Posted: Wednesday 28 January 2015 9:25
by ThinkPad
Maybe by setting a user variable to 1 (TRUE) and setting it to 0 after a few minutes. The event could look like this:
IF motion = On AND var = 0
DO <send Prowl>
DO SET var = 1
And then create a second event which does something like this:
IF var = 1
DO SET var = 0 AFTER 5 minutes
Re: Blockly examples
Posted: Tuesday 24 February 2015 18:30
by Bikey
Hi,
I'm new to Domtoticz and Blockly and are experimenting with its functions. Great stuff!
However I have a simple scenario which seems hard to create using Blockly:
What I want is (during certain times) to switch on a lamp or group if a motion sensor gets triggered.
Then after after e.g. 10 minutes the lamp must turn of. That's easy and got it working:
It's something like:
If MotionSensor = "On"
Then Set Lamp="ON"
SET Lamp="Off" After "600" seconds.
However, I don't want the Lamp to be switched off if there is motion detected within 10 minutes after the first, second etc. detection.
The "SET xx=on/of After yy seconds" statement however will not run unless the timer is expired (as by design).
So how can I prolong the "off"-timer each time the Motion Sensor is triggererd with Blockly?
Re: Blockly examples
Posted: Tuesday 24 February 2015 19:04
by markk
You may be better off using a smart PIR script here:
http://www.domoticz.com/wiki/Smart_Lua_Scripts
Credit to @simonrg you won't need any LUA knowledge. Just the ability to follow instructions

Re: Blockly examples
Posted: Wednesday 25 February 2015 11:50
by D'rMorris
Or you create a dummy switch with an off delay of 600 seconds and include that in your blockly. And use the PIR to switch the dummy switch to on if there is movement.
So: if motion detected, switch dummy switch on.
then you can switch the lamp on/off based on the dummy switch.
I'd still go the LUA way, by the way. Because now you only want to switch it based on motion, but later you'll want to switch it on motion, but only when it's after sunset. And if the lux level is lower than x value.
And only on Sundays, when it rains. But only if it didn't rain the last 3 days. And if the media player is not on.

.
Re: Blockly examples
Posted: Saturday 07 March 2015 23:44
by ThinkPad
Event to control virtual switch 'IsDark'
You can use this event to control a virtual switch, called 'IsDark'. You can then use the 'IsDark' in your other events to check if it is dark outside.
You may think, why not use a simple timer to turn this virtual switch on/off?
The timer will only switch at the configured moment. But if that moment is missed because the Pi had a power failure for example, your lights will never turn on after the Pi has booted again, because Domoticz won't check if the switch has turned on if the configured switch time has passed.
The event is different in this, because it will ALWAYS check the conditions and thus works always. If you boot your Pi in the middle of the night (after it has been off for the whole day) and the virtual switch is still in the 'day' setting, the event will turn it to the correct setting (=IsDark is on).
Works great!
Downside of the event is that you lose the 'XX minutes before/after sunset' possibility.
P.S. The 'OR' in the 'ELSE IF' line is correct. Domoticz validates till 23:59, at 0:00 a new day starts. Therefore by using 'AND' the condition will never become true.
Re: Blockly examples
Posted: Tuesday 14 April 2015 0:30
by floris74
Hi,
Maybe it's already written, but... Is there a way to switch individual lua scripts and blockly events on and off from the dashboard? that would be family-friendly for some blockly and lua scripts. for example switch on and of the blockly to have my somfy screens autocratically or not.
Floris
Re: Blockly examples
Posted: Tuesday 14 April 2015 8:25
by StanHD
You can create a virtual "Auto" switch something like this:-
And use it something like this:-
Place the virtual switch on the dashboard and the automatic function can then be enabled or disabled. I have one of these for nearly all of my automation functions. For example, most of my lighting is on PIR control. This is fine normally when there are just 2 of us at home, however, can be a little annoying when we have guests, therefore, we just set the appropriate auto switches to off. A useful "by-product" of this is that you can set a timer schedule against the "Auto" switch, so that you can enable / disable the automation for whatever reasons.

Re: Blockly examples
Posted: Tuesday 14 April 2015 17:30
by floris74
Thanks! A similair thing crossed my mind just when i went to bed. Great by-product! Didn't through of it!
Floris
Re: Blockly examples
Posted: Saturday 25 April 2015 23:08
by floris74
I'm having a tiny problem. my screen is going down after the 120 seconds. but even when there is not enough light within the 120 seconds. so i need to figure out how to activate the event only when there is light for 120 seconds or more. something like; "if lux is > 35000 for 120 seconds then screen is on". But i can't see how to fix that in blockly. can anybody help?
Floris
Re: Blockly examples
Posted: Sunday 26 April 2015 9:20
by leby
Think you need a little bit of lua.. I use a lua script to know how long time have passed since my motion sensor was breached, guess you can exchange the motion sensor with a dummy switch that is turned on when you have >3500 lux.
1) Create o dummy switch
2) Create one user variable named "Dummy switch time" give it a start value of say '1'
3) Make a blockly event that turns on the dummy switch when the sensor is >3500 lux and off if sensor is <3400
4) Add the script below to the script folder
5) now you can build your event and trigger on the value of the variable "Dummy switch time" (for example if its more than 120 or what ever)
Code: Select all
commandArray = {}
t1 = os.time()
t2 = uservariables['Dummy switch time']
r0 = t1-t2
commandArray['Variable:Timewithmorethan3500'] = tostring(r0)
print('Timewithmorethan3500 ' .. r0)
return commandArray
Think this i principle should work with your scenario..
Re: Blockly examples
Posted: Monday 27 April 2015 20:03
by thecosmicgate
Is there anybody who can help me with this : I've created a blocky to turn on light when we are not at home , and when we are at home .
But i want to create an blocky who can correct itself : for example :turn lights on ( %), and when we arrive at home correct the % and turn on extra lights or push up the % .
The blocky i created :
