Page 1 of 1

Reading Lux sensor with Blocky

Posted: Monday 11 April 2016 13:15
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.

Re: Reading Lux sensor with Blocky

Posted: Monday 11 April 2016 22:03
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


Re: Reading Lux sensor with Blocky

Posted: Monday 11 April 2016 22:52
by kritjuu
Thank you for the answer. Yes the curtains stop automatically
Can you explain what a "time" script is?

Re: Reading Lux sensor with Blocky

Posted: Monday 11 April 2016 23:38
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