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

My First Scene, after sunset - motiondetector (HC3, Block) not working


Kouzco

Question

I'm setting up my first scene, it's simple so far, just trying to get the basics to work, but no luck.

Please login or register to see this attachment.

All i want so far is the light to light up if i walk into the bathroom after sunset. But i can't ge tit right.

If i remove the sunrise/sunset trigger the light goes on. So i know it's not an issue with the detector.

what am I doing wrong here?

 

The only thing I can think of is that the scene will now only activate if its 1 minute after sunset, 1 minute before sunerise and i trigger the motion at the same time. which i ofc impossible. 

If this is the case, how to I get a scene to trigger while dark outside?

 

totalnoob

Edited by Kouzco
Link to comment
Share on other sites

Recommended Posts

  • 0
  • Inquirer
  • Hey guys!

    Thanks for the feedback. Like i've said before, I'm sorry for the slow response. But a mixture of work and family makes  the time I have to look into this very little and very spread apart.

     

    I've now tried implementing and heres is what I have done.

     

    Declaration side has stayed untouched, but for simplicity I will quote it here.

    Quote
    {
      conditions = { {
          id = 138,
          isTrigger = false,
          operator = "<=",
          property = "value",
          type = "device",
          value = 0
        }, {
          id = 136,
          isTrigger = true,
          operator = "==",
          property = "value",
          type = "device",
          value = true
        }, {
          conditions = { {
              isTrigger = false,
              operator = "match>=",
              property = "cron",
              type = "date",
              value = { "00""20""*""*""*""*" }
            }, {
              isTrigger = false,
              operator = "match<",
              property = "cron",
              type = "date",
              value = { "00""08""*""*""*""*" }
            } },
          operator = "any"
        } },
      operator = "all"
    }

     

    On the Ation side I added "local light = 133" on the third line. I assume this is for the LUA to include it in the code (?). Then I added " fibaro.getValue(133,"value") " on the line after " safeTime,"to maxTime ",maxTime) "

     

    I'm not sure whats gone wrong, because now the scene won't run at all when someone enters the room. So that naturally results in me not beeing able to check if the function we wanted added works.

    See below.

     
     
    Quote
    local light = 134
    local motion1 = 136
    local light = 133
     
    local maxTime = 1*60  -- max time the 
    local sleepTime = 5   -- time in seconds 
     
    fibaro.debug("","Turning on")
    fibaro.call(light,"turnOn")
     
    local safeTime = 0
    while safeTime < maxTime do
      fibaro.sleep(sleepTime*1000)            
         
      safeTime=safeTime+sleepTime             
          -- count up safeTime
      fibaro.debug("","Counting up safeTime ",
    safeTime,"to maxTime ",maxTime)
      fibaro.getValue(133,”value”) 
    then -- motion breached
         safeTime=0                           
          -- reset safeTime
         fibaro.debug("","Reset")
      end
    end 
      
    fibaro.debug("","Turning off")
    fibaro.call(light,"turnOff"

     

     

    Thanks again!

    Link to comment
    Share on other sites

    • 0
    10 hours ago, Kouzco said:
    fibaro.getValue(133,”value”) 
    then -- motion breached
         safeTime=0                           
          -- reset safeTime
         fibaro.debug("","Reset")
      end


    I think there has to be an if in front of the fibaro.getValue

     

    10 hours ago, Kouzco said:
    local light = 134
    local motion1 = 136
    local light = 133


    And the light value 134 will be overwritten by 133. That won’t do any good. 
     

    I don’t know what the ID’s are for your setup

     

    light = 134 (the light to turn on) ?

    motion sensor = 136 ?

    other light = 133 ?

    and what is ID 138 in the declaration ?

     

    this is what the code should be (but maybe not the correct ID’s)

    Please login or register to see this code.

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 11 hours ago, SmartHomeEddy said:

    light = 134 (the light to turn on) ?

    motion sensor = 136 ?

    other light = 133 ?

    and what is ID 138 in the declaration ?

     

     

     

    134 = the light the motion sensor turns on

    136 = motion sensor

    133 = is the other light. If this light is turned on, then the scene should cancel. As in not turn 134 off again.

     

    138 = is the light sensor (lux)

     

    Ok, I've copied what you quoted in replacing the old.

    When the scene is run the light still does not light.

     under is the current action

    Quote
    local light = 134 -- ID of light to turn on
    local motion1 = 136 -- ID of motion sensor
    local otherlightID = 133 -- ID of other light when turned on, "light" won't turn off
     
    local maxTime = 1*60  -- max time the sensor should be safe before turning off
    local sleepTime = 5   -- time in seconds between each check of the sensor
     
    fibaro.debug("","Turning on")
    fibaro.call(light,"turnOn")
     
    local safeTime = 0
    while safeTime < maxTime do
      fibaro.sleep(sleepTime*1000)            
      safeTime=safeTime+sleepTime -- count up safeTime
      fibaro.debug("","Counting up safeTime ",safeTime,"to maxTime ",maxTime)
      if fibaro.getValue(motion1,”value”) or fibaro.getValue(otherlightID,”value”) != 0 then -- motion breached or other light is on
         safeTime=0 -- reset safeTime
         fibaro.debug("","Reset")
      end
    end 
      
    fibaro.debug("","Turning off")
    fibaro.call(light,"turnOff")

     

    Link to comment
    Share on other sites

    • 0

    But did you meet all conditions according to the declarations?

     

    It must be dark (lux <= 0)

    there must be movement

    it must be between 20:00 and 8:00 hour

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 9 minutes ago, SmartHomeEddy said:

    But did you meet all conditions according to the declarations?

     

    It must be dark (lux <= 0)

    there must be movement

    it must be between 20:00 and 8:00 hour

    I did yes.

    And I've also tried running the scene manually. It does not light even then. So something is canceling it out?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 7 hours ago, SmartHomeEddy said:

    Do you see anything in the debugging screen?

    [SCENE47]: (load):16: unexpected symbol near '<\226>'

    I'm assuming this is the culprit ?

    Link to comment
    Share on other sites

    • 0

    Please replace this line

     

    Please login or register to see this code.

    With

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Done!

    Still same error 

    Quote

    [16.08.2020] [01:08:33] [ERROR] [SCENE47]: (load):16: unexpected symbol near '<\226>'

    Actions now:

    Quote
    local light = 134 -- ID of light to turn on
    local motion1 = 136 -- ID of motion sensor
    local otherlightID = 133 -- ID of other light when turned on, "light" won't turn off
     
    local maxTime = 1*60  -- max time the sensor should be safe before turning off
    local sleepTime = 5   -- time in seconds between each check of the sensor
     
    fibaro.debug("","Turning on")
    fibaro.call(light,"turnOn")
     
    local safeTime = 0
    while safeTime < maxTime do
      fibaro.sleep(sleepTime*1000)            
      safeTime=safeTime+sleepTime -- count up safeTime
      fibaro.debug("","Counting up safeTime ",safeTime,"to maxTime ",maxTime)
      if fibaro.getValue(motion1,”value”) or tonumber(fibaro.getValue(otherlightID,”value”)) > 0 then -- motion breached or other light is on
         safeTime=0 -- reset safeTime
         fibaro.debug("","Reset")
      end
    end 
      
    fibaro.debug("","Turning off")
    fibaro.call(light,"turnOff")

    Djees... This LUA stuff is hard. :)
    Thanks for the hep so far :)

    Link to comment
    Share on other sites

    • 0

    If have tested this code om my setup with some different ID's and this works now. I have added a debug tag for more easy debugging and an extra debug message to see wat the script does (motion or other light). Copy - Paste and lets see...

     

    Please login or register to see this code.

     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0

    Hi, 

    I'm new to this LUA scripting also and could use your script to make a start for dimming kitchen lights; when nobody is in the kitchen, lights will be go back to 30%

     

    I used your script for this: 

     

    {
      conditions = { {
          id = 43,
          isTrigger = true,
          operator = "==",
          property = "state",
          type = "device",
          value = true
        }, {
          id = 27,
          isTrigger = true,
          operator = "==",
          property = "value",
          type = "device",
          value = true
        } },
      operator = "all"
    }

     

    local light = 43
    local motion1 = 27
     
    local maxTime = 1*60  -- max time the sensor should be safe before turning off
    local sleepTime = 5   -- time in seconds between each check of the sensor
     
    fibaro.debug("","Turning on to 90%")
    fibaro.call(light,"setValue","90")
     
    local safeTime = 0
    while safeTime < maxTime do
      fibaro.sleep(sleepTime*1000)            
         
      safeTime=safeTime+sleepTime             
          -- count up safeTime
      fibaro.debug("","Counting up safeTime ",
    safeTime,"to maxTime ",maxTime)
      if fibaro.getValue(motion1,"value") 
    then -- motion breached
         safeTime=0                           
          -- reset safeTime
         fibaro.debug("","Reset")
      end
    end 
      
    fibaro.debug("","Dimming to 30%")
    fibaro.call(light,"setValue","30")

     

    Thnx anyway i could use this.

     

    I changed some little things:

    - in the condition I changed 'value' to 'state' (because the lights already switched on).

    - in the action part I put a 'setValue' to 90%

    - and did some debug changes.

     

    For so far it works well

     

    Still I have a some questions:

    Here are some logs:

    [19.08.2020] [00:40:41] [DEBUG] []: Counting up safeTime 10 to maxTime 60
    [19.08.2020] [00:40:46] [ERROR] [SCENE25]:
    [19.08.2020] [00:40:46] [DEBUG] []: Turning on to 90%
    [19.08.2020] [00:40:51] [DEBUG] []: Counting up safeTime 5 to maxTime 60

     

    Why there is an 'error in this scene?

     

    One other question:

    dimming to 30% is very nice and slow, that's ok, i changed some parameter in the Dimmer 2.

    But dimming back to 90%, could be faster, as my Motion trigger some action, ít would be nice the person in the kitchen gets some light quicker. Is there a possibility to script this in the LUA?

     

     

     

     

    Link to comment
    Share on other sites

    • 0

    Goodmorning, 

    yes, it's the correct scene, all other scenes i switched off:

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    Strange, nothing here
     

    Please login or register to see this code.


     

    maybe this setting?

     

    Please login or register to see this image.

    /monthly_2020_08/78AF9790-1CCE-4759-BAEF-7EC914B3766F.jpeg.d7997ef095867bc113dc504630945227.jpeg" />


     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0

    Yeah, strange... i will check again, during the day...

     

    But do you have some answers on my second question? I would like 2 different speed's: 1 for dimming to 30% and dimming back to 90%

    Link to comment
    Share on other sites

    • 0

    Maybe the “allow to restart” setting?

     

    4 minutes ago, Sijbrand said:

    I would like 2 different speed's: 1 for dimming to 30% and dimming back to 90%


    I don’t use that function, it is just on its default setting. You could however alter the parameter setting from Lua, but I don’t know how reliable that is, doing it often maybe with short intervals. 
     

    I use this in my humidity scene:

    Please login or register to see this code.

    But on my search then, I got a warning to use it carefully. 

    Link to comment
    Share on other sites

    • 0
    53 minutes ago, SmartHomeEddy said:

    Strange, nothing here
     

    Please login or register to see this code.

     

     Did you filter also on 'Error'?

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    No filter, all messages

     

    Did you check the allow restart setting?

     

     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0
    9 minutes ago, SmartHomeEddy said:

    No filter, all messages

     

    Did you check the allow restart setting?

     

     

     

    aha.... i change it to 'Nee', and no error this time... that's the solution !

     

    Please login or register to see this image.

    /monthly_2020_08/image.png.b6a630be03f4efb3b5d8e451fb4d054a.png" />

     

    Thnx... 

    Edited by Sijbrand
    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 8/16/2020 at 10:39 AM, SmartHomeEddy said:

    If have tested this code om my setup with some different ID's and this works now. I have added a debug tag for more easy debugging and an extra debug message to see wat the script does (motion or other light). Copy - Paste and lets see...

     

    Please login or register to see this code.

     

     

    I've been testing it over 2 days now and it seems to be working. Will rund a few more test and get beck to you. 

    But so far so good. Thanks a lot!! ??

    • Like 1
    Link to comment
    Share on other sites

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