Blockly examples

Moderator: leecollings

bletellier
Posts: 1
Joined: Wednesday 26 March 2014 0:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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 39905 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 39905 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.
maluko
Posts: 105
Joined: Sunday 02 February 2014 23:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Portugal
Contact:

Re: Blockly examples

Post 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
maluko
Posts: 105
Joined: Sunday 02 February 2014 23:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Portugal
Contact:

Re: Blockly examples

Post 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
fwehrle
Posts: 41
Joined: Tuesday 11 February 2014 18:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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
rron
Posts: 247
Joined: Sunday 30 March 2014 15:24
Target OS: Linux
Domoticz version: Beta
Location: Waterland
Contact:

Re: Blockly examples

Post 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
Rpi, RFXcom, klikaan klikuit switch,thermosmart, z-wave, espeasy, smartevse
nickasimir
Posts: 4
Joined: Thursday 01 May 2014 14:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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
Last edited by nickasimir on Thursday 15 May 2014 11:41, edited 1 time in total.
nickasimir
Posts: 4
Joined: Thursday 01 May 2014 14:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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
Korrel
Posts: 9
Joined: Friday 31 January 2014 11:02
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post 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 ?
Attachments
Swimming pool heating.png
Swimming pool heating.png (26.34 KiB) Viewed 39647 times
Korrel
Posts: 9
Joined: Friday 31 January 2014 11:02
Target OS: Linux
Domoticz version:
Contact:

Re: Blockly examples

Post by Korrel »

I see people excluding days in their equations, like day <> saturday AND day <> sunday ...

This will also work flawlessly ;)
Attachments
weekdays.png
weekdays.png (3.86 KiB) Viewed 39691 times
D'rMorris
Posts: 138
Joined: Thursday 01 May 2014 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands - Sittard
Contact:

Re: Blockly examples

Post 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


jjnj

Re: Blockly examples

Post 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
User avatar
bizziebis
Posts: 182
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Blockly examples

Post by bizziebis »

Change it to

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

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

Re: Blockly examples

Post 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
Last edited by jjnj on Tuesday 26 August 2014 14:29, edited 1 time in total.
jjnj

Re: Blockly examples

Post 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
Last edited by jjnj on Tuesday 26 August 2014 14:29, edited 1 time in total.
jjnj

Re: Blockly examples

Post 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
drdracer
Posts: 1
Joined: Monday 08 September 2014 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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 39361 times
Heisenberg
Posts: 135
Joined: Monday 27 January 2014 14:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Blockly examples

Post 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?
Attachments
Domoticz.png
Domoticz.png (41.17 KiB) Viewed 39345 times
Raspberry Pi Type B
Raspberry Pi Type B2
RFXCOMtrx433e
ErikCramer
Posts: 11
Joined: Saturday 01 February 2014 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by ErikCramer »

Is it also possible to make some thing like if time = sunset + 30 minutes then the light goes on ?
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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.
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest