Reading Lux sensor with Blocky

Moderator: leecollings

Post Reply
kritjuu
Posts: 5
Joined: Sunday 03 January 2016 23:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Reading Lux sensor with Blocky

Post by kritjuu »

I have Aeotec Multisensor. I want to use the Lux sensor for closing the curtains when there is a lot of sunshine.
Is this possible with blocky editor, because I do not understand the LUA scripting language?
The Aeotec Lux sensor is in a utility device and is a purple utility block which means I can only use to check actual values.
I want to close the curtains when the lux sensor reads >1000. How can I fix this?. With blocky noting happens.
georgesattali
Posts: 84
Joined: Saturday 05 March 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Reading Lux sensor with Blocky

Post by georgesattali »

Hello,
I think that it is not possible without lua.
Here an example to extract several values from a multi valued sensor :

Maybe you could try to create a "time" script :

- But a question, how is the curtains closing stopped ? is it automatic ?

Code: Select all

      
commandArray = {}                      -- required  

-- Barometre returns 5 values  - 5 times (.*)  only 4 ";"
sWeatherTemp, sWeatherHumidity, sWeatherUV, sWeatherPressure, sWeatherUV2      
   = otherdevices_svalues["Météo Baromètre"]:match("(.*);(.*);(.*);(.*);(.*)")              

-- print just prints in the Log
print("-- Irrigation ==> [Baromètre] - Temperature: " .. sWeatherTemp .. " ")     
print("-- Irrigation ==> [Baromètre] - Humidity: " .. sWeatherHumidity .. " ")
print("-- Irrigation ==> [Baromètre] - UV: " .. sWeatherUV .. " ")      
print("-- Irrigation ==> [Baromètre] - Pressure: " .. sWeatherPressure .. " ")      
print("-- Irrigation ==> [Baromètre] - UV2: " .. sWeatherUV2 .. " ")      
      
if sWeatherUV >= 1000 then
   commandArray["curtains"] = "On"         -- that's the blocky "Set curtains= On"
end
      
return commandArray                            -- required

kritjuu
Posts: 5
Joined: Sunday 03 January 2016 23:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Reading Lux sensor with Blocky

Post by kritjuu »

Thank you for the answer. Yes the curtains stop automatically
Can you explain what a "time" script is?
georgesattali
Posts: 84
Joined: Saturday 05 March 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Reading Lux sensor with Blocky

Post by georgesattali »

It's a script called every minute. It means that every minute it will check visibility.

In this case, you may also use a "device" script that would be called each time visibility changes. Typically every 40 s in the case of a temperature, don't know for Lux sensor.

When you're in "Setup/Events", choose Lua instead of Blockly, choose "Time" instead of "All"

Bye,GD
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest