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

Help with a simple lights on by motion at night


Question

Posted

Evening all. 

 

I have had a HC2 now for a while and always used blocky scenes. You could say i have been living the blocky life for the last 5+ years!

 

I am starting to get frustrated with the lights/rgbw's going off and staying off when there is a lots of movement in the room. I have been advised that LUA is the way forward and will be able to get round this issue. 

 

So the way i currently work my scenes for auto lights depending solely of motion and time of day is per the attached screen shots.

 

Can anyone help me out with a script that i could user per room to accomplish this?

 

I have found a script to turn the lights on when motion is detected and every time motion is detected, the timer will reset (and work 90% of the time) but if i use this script, the lights would be coming on during daylight and i do not want this. I just want them to come on when the time is past sunset and before sunrise. 

 

Every room of my house has a Fibaro motion sensor and Fibaro RGBW or dimmer modal installed and would love this to work properly.  

 

If anyone could help me out, that would be ace!

 

Thanks,

 

Hal 

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

2 answers to this question

Recommended Posts

  • 0
Posted

I had a similar ask last year. take a look at this. you will have to modify the code but it works really well for me.

 

 

  • 0
  • Inquirer
  • Posted (edited)

    Thanks for the reply amatt.

     

    I have been playing with the code and learned a fair bit on the way but got my lights auto turning on when motion is detected and when the global variable Auto_Lights = Night. :D

     

    All is working ok and will continue to test tomorrow when there is a lot more movement around the house. 

     

    I did see the following in the code but could not work out what it was for: - 

     

    local function inArray(needle, haystack)
        for i,n in ipairs(haystack) do
            if (tonumber(needle)==tonumber(n)) then
                return true;
            end
        end

     

    Also, as I have only one sensor in the kitchen, I have listed it twice as it was needed for the script. When I have some time tomorrow, I will go through it to see if I can reduce it down to 1 sensor in the script without using the average lux. 

     

    Thanks again for the reply and will chat again sometime soon:-) 

     

    All the best,

     

    Hal 

     

    Please login or register to see this code.

     

    Edited by Hallamnet

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