Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Lux value not changing in lua script


Question

Posted

I have a simple script to determine on which lux values I want to trigger. It should output the current lux value. It does do that (I think) however even if I turn the lights on very bright the lux value will not change. What should I do to get the current lux value each and every time?

 

-- This script can be used to print the current lux value of a Light sensor set in md1 variable
 
--[[
%% autostart
%% properties
%% globals
--]]
 
local jT = json.decode((fibaro.getGlobalVariable("HomeTable")))
 
-- Get Device IDs
md1 = jT["Badkamer/Badkamer Light"]
 
-- Set required variables
 
local lux = 0;
local lightLevelName = ""
 
-- Get detected Lux value
lux = tonumber(fibaro.getValue(md1,"value"));
 
if lux < 1 then
    lightLevelName = "Pitch Black";
  elseif lux < 10 then
    lightLevelName = "Very Dark";   
  elseif lux < 300 then
    lightLevelName = "Dark Indoors";
  elseif lux < 800 then
    lightLevelName = "Dim Indoors";
  elseif lux < 3000 then
    lightLevelName = "Normal Indoors";
  elseif lux < 5000 then
    lightLevelName = "Bright Indoors";
  elseif lux < 10000 then
    lightLevelName = "Dim Outdoors";
  elseif lux < 30000 then
    lightLevelName = "Cloudy Outdoors";
  elseif lux < 100000 then
    lightLevelName = "Direct Sunlight";
  end;
 
-- Printout to console
print("Current LUX Level of Light Sensor ",md1," is: ",lux, " which can be compared to ", lightLevelName)

 

3 answers to this question

Recommended Posts

  • 0
Posted

Hi @markb81,

 

Which sensor do you use for measuring lux?

 

  • 0
  • Inquirer
  • Posted

    Fibaro Motion Detector

    • 0
    Posted

    And in your dashboard you do see different lux values during the day?

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...