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

Force read lux from montion sensor LUA


Question

Posted
 
 
 
377/5000
 
 
 
I want to make a scene that turns on a light if it detects movement and makes less than x lux.
The problem is that it detects me the luxes that it has "recorded" since the last time.
How can I force him to read the luxes at the moment of movement?

Another question is, if I can do that, I would like the light I turn on to last 120 seconds.
How to do it?
All in LUA.

Thank you.

2 answers to this question

Recommended Posts

  • 0
Posted
6 minutes ago, Borin said:
 
 
 
377/5000
 
 
 
I want to make a scene that turns on a light if it detects movement and makes less than x lux.
The problem is that it detects me the luxes that it has "recorded" since the last time.
How can I force him to read the luxes at the moment of movement?

Another question is, if I can do that, I would like the light I turn on to last 120 seconds.
How to do it?
All in LUA.

Thank you.

Do it in blocks then convert to LUA with convert button.

That will get you started.

  • 0
Posted
With the function ActivarLux you can wakeup the sensor and read the current lux. In this case, three lights are turn on during 1 minute
 
local status263=fibaro.getValue(263,"value")
local status208=fibaro.getValue(208,"value")
local status290=fibaro.getValue(290,"value")
local message=""
 
ActivarLux = function(id)
    fibaro.wakeUpDeadDevice(id)
    local status=fibaro.getValue(id,"value")
    message = "LUX: ".. status
    fibaro.debug(message)
    return status
end
 
local status410 = ActivarLux(410)
 
if (status410<=10then
    fibaro.debug("Activa Luces")
    fibaro.call(263'turnOn')
    fibaro.call(208'turnOn')
    fibaro.call(290'turnOn')
    -- Lee lux
    fibaro.sleep(5000)
    status410=ActivarLux(410)
 
    -- Temporizador de la escena
    fibaro.sleep(60000)
 
    -- Devuelve al estado inicial
    fibaro.call(263,"setValue",status263)
    fibaro.call(208,"setValue",status208)
    fibaro.call(290,"setValue",status290)
else
    fibaro.debug("No activa luces")
end
 
fibaro.debug("Fin Escena")
-- Lee lux
fibaro.sleep(3000)
status410=ActivarLux(410)

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...