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

If movement burn lamp


Question

Posted (edited)

Hi tried to made a scene, but after many tries, I didn't succeeded.

 

Problem:

I have a Fibaro  Sensor and and Lamp dimmer in the hall. I made a simple scene, if Sensor detect movement automatically the lamps starts to burn to X seconds. 

But I like to make to real time. If movements, the lamp has to burn for X seconds, but for new movements the counter has to be reset to X seconds.

 

So If people are moving in the hall, the lamp should be switch on for X second. So in fact if movement has been countered the the lamp burn counter should be reset.

 

I tried to create to made events, if movement than "Hall_movement_on", but can't make it works real time.

 

Request:

Who has experience making (lua) scene, with hc3 and this request.

 

Hope you help me out.

 

thx

 

Edited by Tikilauda
mistake in sentence

12 answers to this question

Recommended Posts

  • 0
Posted (edited)

@Tikilauda Which homecenter are you on?

 

 

 

Edited by SmartHomeEddy
  • 0
Posted
3 hours ago, Tikilauda said:

with hc3 and this request.

Hi @SmartHomeEddy :-D

  • Like 1
  • 0
  • Inquirer
  • Posted

    indeed HC3

    • 0
    Posted

    There are several solution. This is one of them:

     

     

     

    • Like 1
    • 0
  • Inquirer
  • Posted

    Thx Eddy,

     

    I have a look to the code as well, hope it's feasible for my solution as well.

     

    Best regards

    Frank

     

     

    • 0
    Posted
    11 hours ago, Tikilauda said:

    hope it's feasible for my solution as well.

     

    It will work

    • 0
    Posted

    hi,

    how can I do it in HC2? :)

    • 0
    Posted

    Replace fibaro. with fibaro: and pray ?

    • 0
    Posted (edited)

    To make it very simple

     

    Change settings to pir: safe time is 60 sec (set the time that you want the light to lit)

     

    2 scenes:

    if pir is breached, light on

     

    if pir is safe: light off

     

     

    Please login or register to see this attachment.

    Edited by akatar
    • Like 1
    • 0
  • Inquirer
  • Posted

    I installed the lua code. It's works fine, but intermittent the light goes on, without any movement in the hall, but with ërror in the log.

    Any idea what I did wrong.

     

    [29.12.2020] [05:04:56] [ERROR] [SCENE83]:
    [29.12.2020] [05:04:56] [DEBUG] [HAL LIGHT]: Turning on (ID 39) Hal licht for 60 seconds
    [29.12.2020] [05:05:01] [DEBUG] [HAL LIGHT]: Counting up safeTime 5 to maxTime 60
    [29.12.2020] [05:05:01] [DEBUG] [HAL LIGHT]: Reset by Motion sensor 23 PIR-01-Hal
    [29.12.2020] [05:05:06] [DEBUG] [HAL LIGHT]: Counting up safeTime 5 to maxTime 60
    [29.12.2020] [05:05:11] [DEBUG] [HAL LIGHT]: Counting up safeTime 10 to maxTime 60
    [29.12.2020] [05:05:16] [DEBUG] [HAL LIGHT]: Counting up safeTime 15 to maxTime 60
    [29.12.2020] [05:05:21] [DEBUG] [HAL LIGHT]: Counting up safeTime 20 to maxTime 60
    [29.12.2020] [05:05:26] [DEBUG] [HAL LIGHT]: Counting up safeTime 25 to maxTime 60
    [29.12.2020] [05:05:31] [DEBUG] [HAL LIGHT]: Counting up safeTime 30 to maxTime 60
    [29.12.2020] [05:05:36] [DEBUG] [HAL LIGHT]: Counting up safeTime 35 to maxTime 60
    [29.12.2020] [05:05:41] [DEBUG] [HAL LIGHT]: Counting up safeTime 40 to maxTime 60
    [29.12.2020] [05:05:46] [DEBUG] [HAL LIGHT]: Counting up safeTime 45 to maxTime 60
    [29.12.2020] [05:05:51] [DEBUG] [HAL LIGHT]: Counting up safeTime 50 to maxTime 60
    [29.12.2020] [05:05:56] [DEBUG] [HAL LIGHT]: Counting up safeTime 55 to maxTime 60
    [29.12.2020] [05:06:01] [DEBUG] [HAL LIGHT]: Counting up safeTime 60 to maxTime 60
    [29.12.2020] [05:06:01] [DEBUG] [HAL LIGHT]: Turning off 39 Hal licht

     

    Conditions:

    {
     
     conditions = { {
          id = 23,
          isTrigger = true,
          operator = "==",
          property = "value",
          type = "device",
          value = true
        }, {
          isTrigger = true,
          operator = "==",
          property = "schemer",
          type = "global-variable",
          value = "Ja"
        } },
      operator = "all"
    }
     
    Action:
    -- This scene turns on one or more lights: 
    --    turns off the lights after a certain time (maxTime), 
    --    unless there is motion from one or more Motion sensors
     
    -- Please enter the right ID's (if more than one, seperate by ",") and the prefered maxTime for the lights to stay on 
     
    local light = {39-- ID's of the lights to turn on
    local motion = {23-- ID's of the Motion sensors to check if they are breached
    local maxTime = 1*60  -- Maximum time the sensor should be safe before turning off (n*60 where n is minutes)
    local sleepTime = 5 -- Time in seconds between each check of the Motion sensor (default = 5)
    local debug_TAG = "Hal light" -- Tag for the debug messages
     
    -- Below here no changes are necessary
     
    for i in pairs(light) do -- Turn on the lights
      fibaro.debug(debug_TAG,"Turning on (ID " ..light[i] ..") " ..fibaro.getName(light[i]) .." for " ..maxTime .." seconds")
      fibaro.call(light[i],"turnOn")
    end
     
    local safeTime = 0
    while safeTime < maxTime do -- Loop until maxTime is reached
      fibaro.sleep(sleepTime*1000)                 
      safeTime=safeTime+sleepTime 
      fibaro.debug(debug_TAG,"Counting up safeTime " ..safeTime .." to maxTime " ..maxTime)
      for i in pairs(motion) do 
        if fibaro.getValue(motion[i],"value"then -- Check if Motion sensors are breached
           fibaro.debug(debug_TAG,"Reset by Motion sensor " ..motion[i] .." " ..fibaro.getName(motion[i]))
           safeTime = 0 -- Reset safeTime to zero
        end
      end
    end 
      
    for i in pairs(light) do -- Counted down to maxTime, turn off the lights
      fibaro.debug(debug_TAG, "Turning off " ..light[i] .." " ..fibaro.getName(light[i]))
      fibaro.call(light[i],"turnOff"
    end
     
    Help is appreciated.
     
    • Like 1
    • 0
    Posted
    6 minutes ago, Tikilauda said:
     isTrigger = true,
          operator = "==",
          property = "schemer",
          type = "global-variable",
          value = "Ja"

     

    Your Global variable should not be a trigger, only a condition: isTrigger = false

    • 0
  • Inquirer
  • Posted

    Thank you so much! Really appreciated Eddy. 

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