Page 4 of 36

Re: Blockly examples

Posted: Wednesday 26 March 2014 23:23
by bletellier
Hi, I have a very simple need ans also simple to understand.
When there is too much wind => I want the blinds go up to not be damaged.

I try this event:
QuestionEventsBlockly_01.gif
QuestionEventsBlockly_01.gif (6.63 KiB) Viewed 39907 times
If the wind is stronger than 2.5 m / s then up blinds

=> but it does not work

But it seems that my device "Vent" (wind) does not give a value but a string
with 6 values separated by semicolon (;)
QuestionEventsBlockly_03.gif
QuestionEventsBlockly_03.gif (180.57 KiB) Viewed 39907 times
Questions:
1) Is it possible to recover only the value "speed" of this device "Vent" ?
2) Is it possible with a LUA script to create objects (virtual) that can be found in "Blockly" ?

Thanks.

Re: Blockly examples

Posted: Friday 28 March 2014 20:52
by maluko
Hi

I want do a event with this rule:

Turn on "quarto alice" and "Sala de Estar"
-when isnt sunday or saturday
- when "ferias" are off
- and is 7:40

this event is ok?

Image

Thanks

Re: Blockly examples

Posted: Saturday 29 March 2014 10:39
by maluko
maluko wrote:Hi

I want do a event with this rule:

Turn on "quarto alice" and "Sala de Estar"
-when isnt sunday or saturday
- when "ferias" are off
- and is 7:40

this event is ok?

Image

Thanks

Dont work :( this open on saturday at 7:40

Re: Blockly examples

Posted: Wednesday 02 April 2014 21:39
by fwehrle
Hi,
Any idea why this blockly didn't work?
Temp and luminosity are both dummy filled by script.
https://dl.dropboxusercontent.com/s/3gp ... r6QLodgBHQ
Image
Thank you very much

Re: Blockly examples

Posted: Saturday 03 May 2014 12:54
by rron
Heisenberg wrote:
bizziebis wrote:I've also added a KAKU switch to my mechanical ventilation. I didn't touch the perilex plug. I opened up the unit and directly attached the wires from the KAKU to the PCB of the ventilation system.

I made some blocky events to controll it all. It can be controlled manualy by virtual switches or automatically by measuring the humidity of the bathroom.
I'va also added an option to override the current settings. In case I get tired of the fan running full speed when my girlfriend is showering after a late shift :D

The events can be optimised and some things can be put together. But then I have to send multiple signals to just make one switch. And that's something I'm not willing to do because the RfxCom is interfering with my digital tv (RTL5 HD and SBS6 HD). So with the current events it's reduced to sending only the needed signals.

The override event is not optimised at all. But I almost never use it so I didn't bother to change it yet :)

Level 1:

Image

Level 2:

Image

Level 3:

Image

Override:

Image

bizziebis, care to share some pictures of your KAKU wiring solution attached to the PCB?
Did you use the same wirering diagram as macaidwin did with the acm 3500?
Thx

Re: Blockly examples

Posted: Wednesday 14 May 2014 14:39
by nickasimir
A simple blockly

1. when sensor is on at time between 00:01 and 20h59
2. set dimmer on a 60% for 1 minutes
3. sensor off set off dimmer.

Image

Re: Blockly examples

Posted: Wednesday 14 May 2014 16:57
by nickasimir
a new simply blocky for nightly light for my children :)

1. at time 21:00 set dimmer a 100%
2. regulate the dimmer each 10 minutes until 00:00 and set off.

Image

Nicka

Re: Blockly examples

Posted: Tuesday 03 June 2014 15:24
by Korrel
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 ?

Re: Blockly examples

Posted: Tuesday 03 June 2014 15:29
by Korrel
I see people excluding days in their equations, like day <> saturday AND day <> sunday ...

This will also work flawlessly ;)

Re: Blockly examples

Posted: Wednesday 04 June 2014 10:54
by D'rMorris
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 ?
I guess this is due to the fact that the UV is coming from a string of numbers. In my case (don't know if you have the same setup) I don't actually own a weather station but I retrieve the data from Wunderground. Now, if I go to Setup --> Events --> Current States, I get the following from the UV:
21 UV 2014-06-04 10:20:01 5.0;0.0
Now, the first value is the UV value (in UVI) and the second value is Watts per m2. Because this is a string instead of a single number, your UVI comparison fails. What you can do is use a LUA script to extract the values and do stuff based on thresholds. I use the following script myself for my sunscreen.

A different solution would be not to build the complete logic in LUA, but only to derrive the values in LUA and posting them to Domoticz using JSON (using Virtual Sensors).
A third option (use with caution!) is to derrive the values in LUA and writing them directly into the Domoticz database (info available on this forum about that).

I hope this helps you!

Code: Select all

commandArray = {}

--Extract Wind Gust speed from SValue Wind
wind = otherdevices_svalues['Windmeter']
print("Wind: "..wind)

--Filter the third digitsequence from SValue
a = string.sub(wind,1,string.find(wind,';',1,true)-1)
--print("a: "..a)

b = string.sub(wind,string.find(wind,';',1,true)+1)
--print("b: "..b)

winddirection = string.sub(b,1,string.find(b,';',1,true)-1)
--print("Winddirection: "..winddirection)

d = string.sub(b,string.find(b,';',1,true)+1)
--print("d: "..d)

windspeed = string.sub(d,1,string.find(d,';',1,true)-1)
print("Windspeed: "..windspeed)

f = string.sub(d,string.find(d,';',1,true)+1)
--print("f: "..f)

windgust = string.sub(f,1,string.find(f,';',1,true)-1)
print("Windgust: "..windgust)

g = string.sub(f,string.find(f,';',1,true)+1)
--print("g: "..g)

temperature = string.sub(g,1,string.find(g,';',1,true)-1)
print("Temperature: "..temperature)

--Extract UV radiation from SValue Wind
solar = otherdevices_svalues['UV']
print("Solar Radiation: "..solar)
--Filter the first digit from SValue
uv = string.sub(solar,1,string.find(solar,';',1,true)-1)
print("UV: "..uv)

--Extract actual rainfall from Rain_SValue
rain = otherdevices_svalues['Rainmeter']
print("Rain: "..rain)

--Filter the first digit from SValue
currentrain = string.sub(rain,1,string.find(rain,';',1,true)-1)
print("Current rain: "..currentrain)

--Filter the last digit from SValue
totalrain = string.sub(rain,string.find(rain,';',1,true)+1)
print("Total rain: "..totalrain)

--Sunscreen thresholds:
        -- Windspeed            = 100.0 (value is multiplied by 100)
        -- Rain                 =  0.0
        -- UV                   =  4.0
        -- Temperature          = 15.0
        -- Closed       = Down  = On
        -- Open         = Up    = Off

if (timeofday['Daytime'])
        then
                print('It is past sunrise, monitoring variables for sunscreen')
                if (otherdevices['Sunscreen'] == 'Open' ) then
                print ('Sunscreen is up')
        else
                print ('Sunscreen is down')
end

if (otherdevices['Sunscreen']   == 'Open'
        and currentrain         == '0'
        and temperature         > '15.0'
        and uv                  > '4.0')
--        and windspeed                 < '100')

then
        print ('Sun is shining, all thresholds OK, lowering sunscreen')
        commandArray['SendNotification']='Sunscreen#Sunscreen down --> Sun is shining'
        commandArray['Sunscreen']='On'

        elseif (otherdevices['Sunscreen'] == 'Closed' and currentrain > '0') then
                print ('It is raining, raising sunscreen')
                commandArray['SendNotification']='Sunscreen#Sunscreen up --> It is raining'
                commandArray['Sunscreen']='Off'

        elseif (otherdevices['Sunscreen'] == 'Closed' and temperature < '15.0') then
                print ('Temperature too low, raising sunscreen')
                commandArray['SendNotification']='Sunscreen#Sunscreen up --> It is too cold'
                commandArray['Sunscreen']='Off'

        elseif (otherdevices['Sunscreen'] == 'Closed' and uv < '4.0') then
                print ('Sun not shining too bright, raising sunscreen')
                commandArray['SendNotification']='Sunscreen#Sunscreen up --> Sunshine not too bright'
                commandArray['Sunscreen']='Off'

--      elseif (otherdevices['Sunscreen'] == 'Closed' and windspeed > '100') then
--                print ('Windspeed too high, raising sunscreen')
--                commandArray['SendNotification']='Sunscreen#Sunscreen up --> Windspeed too high'
--                commandArray['Sunscreen']='Off'

else
        print('Sunscreen status OK --> No action')
end

elseif (timeofday['Nighttime']
        and otherdevices['Sunscreen'] == 'Closed')
        then
                print('It is night, raising sunscreen')
                commandArray['SendNotification']='Sunscreen#Sunscreen up --> It is night'
                commandArray['Sunscreen']='Off'
        else
                print('Sunscreen already up --> No action')
end

return CommandArray



Re: Blockly examples

Posted: Tuesday 26 August 2014 12:53
by jjnj
The problem i am facing now is the following:
I added my ventilation system to domoticz (afzuiger), when in a room (rookhokje) the humidity goes beyond a certain threshold (65 or higher) to fan should go on, and turn of below a threshold (lower than 65)

This works like a charm, but the issue is, each time my humidity sensor sends feedback the blocky will respons to this. So each couple of minutes when the humidity is below 65 it will send a command to turn the fan off (checked by notifications). How can i change it so it will only change once?

Image

Re: Blockly examples

Posted: Tuesday 26 August 2014 13:32
by bizziebis
Change it to

IF rookhokje hum. >65 AND afzuiger = Off, Do...

Else IF rookhokje hum. <65 AND afzuiger = On, Do...

Re: Blockly examples

Posted: Tuesday 26 August 2014 14:29
by jjnj
bizziebis wrote:Change it to

IF rookhokje hum. >65 AND afzuiger = Off, Do...

Else IF rookhokje hum. <65 AND afzuiger = On, Do...
*double post

Re: Blockly examples

Posted: Tuesday 26 August 2014 14:29
by jjnj
bizziebis wrote:Change it to

IF rookhokje hum. >65 AND afzuiger = Off, Do...

Else IF rookhokje hum. <65 AND afzuiger = On, Do...
*double post

Re: Blockly examples

Posted: Tuesday 26 August 2014 14:29
by jjnj
bizziebis wrote:Change it to

IF rookhokje hum. >65 AND afzuiger = Off, Do...

Else IF rookhokje hum. <65 AND afzuiger = On, Do...
I know but then the issue is that i cannot turn it on manually, i want to turn it on when i am cooking (same fan system for the kitchen).
I put a KAKU switch near my stove so i can manually turn it one while cooking

Re: Blockly examples

Posted: Tuesday 09 September 2014 14:50
by drdracer
Hello,

I made my first blocky for the following scenario: Outside temp is below 3°C and humdity is above 60%,
so the heater has to turn on. When the temperature is above 3°C and humdity is below 60%, the heater should turn off again.

Is this approach correct?
Capture.PNG
Capture.PNG (23.02 KiB) Viewed 39363 times

Re: Blockly examples

Posted: Tuesday 09 September 2014 21:52
by Heisenberg
I want to achieve that the toilet lamp is activated when motion sensor is on. And when there is no motion the lamp goes off. This is my (not working) script. What do I need to do?

Re: Blockly examples

Posted: Wednesday 10 September 2014 8:13
by ErikCramer
Is it also possible to make some thing like if time = sunset + 30 minutes then the light goes on ?

Re: Blockly examples

Posted: Thursday 11 September 2014 13:37
by markk
Heisenberg wrote:I want to achieve that the toilet lamp is activated when motion sensor is on. And when there is no motion the lamp goes off. This is my (not working) script. What do I need to do?
You may be better off using @Simonrg's Smart Lua Scripts for this: http://www.domoticz.com/wiki/Smart_Lua_Scripts

Re: Blockly examples

Posted: Thursday 11 September 2014 13:39
by markk
ErikCramer wrote:Is it also possible to make some thing like if time = sunset + 30 minutes then the light goes on ?
It may be easier to just use the timer function on the switch for this.