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


  • 1

Help - Scene to keep light turned on until motion is safe


Question

Posted

Hi,

 

I'd like to do a simple scene which turn on a lamp when a fibaro motion sensor and keep it on until the sensor return to the safe state.

 

I'm coming from HCL (only block scene) and I used to do that using two scenes: one for turning on the light when sensor is breached. One to turn off the light when the motion is safe.

 

My need is not only to have my light turned on when motion is breached, but keeping it on until I'm out of the room.

 

Could someone help me to do that with LUA?

 

Thanks

 

 

15 answers to this question

Recommended Posts

  • 0
Posted

That is very tricky because even if you are in the room if you are not moving much (eg. watching TV) sensor will not detect you and go to safe turning off lights with you present in the room. One trick is to use timer which will keep lights on even after sensor go to safe mode, but again if it is not long enough for sensor to get your move result is again dark room with you in it. On the other hand if timer is too long then lights will stay on for too long after you leave room. Other solution is to monitor some device status like smart plug power consumption and if it is higher than some minimum to keep lights on. Good example is again watching TV, when TV is on consumption on plug will be higher, and when you turn TV off consumption will drop bellow some minimum and lights will then turn off if sensor is safe.

 

I have solution almost finished but it is written in LUA code and don't have it in block scenes, sorry. In my opinion controlling lighting is the most challenging task for home automation and needs careful planning. My goal is that lighting is turning on and off without needing our action at all. I am there, and it is working fine with some little glitches mostly caused by limitations of motion and light sensors. It is quite complicated scene and is integrated with other systems so before publishing it here on forum I have to write instructions and publish other virtual devices and scenes that have influence.

 

Maybe in the future if I find enough time I will write counterpart in block scenes but block scenes are quite limited and it will require great deal of planning and numerous block scenes to achieve what I done in LUA code. So no promises.

  • 0
  • Inquirer
  • Posted

    Also Lua would be great, I've just moved from hcl to hc2 to solve this problem!

    • 0
    Posted

    That's great cause HC2 is giving really a lot of possibilities and power.

    • 0
    Posted (edited)
    On 10/1/2016 at 1:03 AM, viga81 said:

    Hi,

     

    I'd like to do a simple scene which turn on a lamp when a fibaro motion sensor and keep it on until the sensor return to the safe state.

     

    I'm coming from HCL (only block scene) and I used to do that using two scenes: one for turning on the light when sensor is breached. One to turn off the light when the motion is safe.

     

    My need is not only to have my light turned on when motion is breached, but keeping it on until I'm out of the room.

     

    Could someone help me to do that with LUA?

     

    Thanks

     

     

    You don't need LUA code (or block scene) for that, just use association between sensor and light switch.

    It's simple and the advantage of this, that even HC2 is turned off it continues to work. The association ability designed exactly for case like that.

    Edited by cag014
    • 0
    Posted
    9 hours ago, cag014 said:

    You don't need LUA code (or block scene) for that, just use association between sensor and light switch.

    It's simple and the advantage of this, that even HC2 is turned off it continues to work. The association ability designed exactly for case like that.

    I agree with you cag14, association has that one benefit that it works even HC2 is off, but that is the only benefit.

    • 0
    Posted

    According to viga81's post, he has this functionality with HCL and association  does exactly what he needs.

    I agree with you Sankotronic that sometimes you need more than motion sensor to turn OFF the lights, but  you're guessing that he talks about some kind of living room with TV or some other appliance, it might be not the case.

    For example I'm using association for all my bathrooms (I've five of them) and it works great. There is no any other condition that I need to turn off the light if no movement detected.

     

    viga81 - I'm curios, what kind of room you're talking about?

    • 0
    Posted

    cag14, please read all posts before making any comments. viga81 just moved to HC2 so LUA is ok for him as he already mentioned. Association is ok for some very dark room that never sees light of day like cellar but the rest of the house or apartment definitely need more sophisticated solution don't you agree?

    • 0
    Posted
    13 minutes ago, Sankotronic said:

    cag14, please read all posts before making any comments. viga81 just moved to HC2 so LUA is ok for him as he already mentioned. Association is ok for some very dark room that never sees light of day like cellar but the rest of the house or apartment definitely need more sophisticated solution don't you agree?

    I didn't say that LUA is not OK for him. I just said that he had this functionality on HCL before move to HC2. 

    And yes I have read  the post and I quote:

    " I'd like to do a simple scene which turn on a lamp when a fibaro motion sensor and keep it on until the sensor return to the safe state. "

    I have answered exactly what he asked for.... according to his needs.

    Could you please send an example what more I need for Toilet (room). If you're there turn the light ON, when you leave turn the light OFF (no code required).

    Same as done for toilets at lobby in every hotel across the world (and they are doing that with PIR alone - no controllers).

    Once again I agree that usually you need more sophisticate scene, but there are a lot of examples where is not required.

    In any case is just a thought.... to help Fibaro user.

    • 0
    Posted
    On 1-10-2016 at 0:03 AM, viga81 said:

    Hi,

     

    I'd like to do a simple scene which turn on a lamp when a fibaro motion sensor and keep it on until the sensor return to the safe state.

     

    I'm coming from HCL (only block scene) and I used to do that using two scenes: one for turning on the light when sensor is breached. One to turn off the light when the motion is safe.

     

    My need is not only to have my light turned on when motion is breached, but keeping it on until I'm out of the room.

     

    Could someone help me to do that with LUA?

     

    Thanks

     

     

    i have the same situation in my garage, i setup the pir as follows

    after 300 sec sent save, and associate the light to the pir

    and i think you can change the pux in ther pir setup so it doesn't work above xx lux

     

    • 0
    Posted

    Sankotronic,

    Another good example that simple association is just enough.

     

    • 0
    Posted

    Yes, I admit, you have your point. Anyway for that kind of solution there is no need to spend so much money on z-wave motion sensors and relays or dimmers when you can buy cheap lights with PIR sensor and then you don't need HCL or HC2 at all even to do association. ;)

    • 0
    Posted

    that's a strange point of view

     

    i have the pir garage setup this way and i can still control the light with hc2

    so if easy does it, why not?

    • 0
    Posted (edited)
    14 minutes ago, Sankotronic said:

    Yes, I admit, you have your point. Anyway for that kind of solution there is no need to spend so much money on z-wave motion sensors and relays or dimmers when you can buy cheap lights with PIR sensor and then you don't need HCL or HC2 at all even to do association. ;)

    You're absolutely correct, but... even if these two devices are associated in addition you can monitor the motion with HC2 - for example in my case ,when no movement detected in 30 minutes I'm arming the alarm. So as you can see I need the sensor to identify the motion in side my home. I believe there are more cases that you need the sensor, the light controlling is just one aspect of the sensor. 

    I admire your integrity in this case.

    Edited by cag014
    • 0
  • Inquirer
  • Posted
    12 hours ago, cag014 said:

    According to viga81's post, he has this functionality with HCL and association  does exactly what he needs.

    I agree with you Sankotronic that sometimes you need more than motion sensor to turn OFF the lights, but  you're guessing that he talks about some kind of living room with TV or some other appliance, it might be not the case.

    For example I'm using association for all my bathrooms (I've five of them) and it works great. There is no any other condition that I need to turn off the light if no movement detected.

     

    viga81 - I'm curios, what kind of room you're talking about?

     

    Hi 

     

    thanks to all for the advice. The association trick is perfect for my needs (limber-room and "walk-in closet room", which are both dark with no need to create advanced rules based on lux or other).

     

    On the other hand, this is not applicable e.g. to my bathroom, where I've aldo the variable lux. I was able to do what I wanted with block scenes, but only with two separated scenes (one for turning on checking lux, one for turning off). I was looking for a unique lua scene, hoping to leverage on something like

     

    "while sensor breached and lux>x then lamp turned on."

     

    Thanks

     

     

     

     

    • 0
    Posted (edited)

    Here a simple scene with following assumptions:

    Motion sensor ID = 45

    Lux sensor ID = 46

    Light switch ID = 47

     

    Please login or register to see this code.

     Changed device IDs according to your real devices

    Edit-

    Have added trigger verification

    Edited by cag014

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