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

Another lights of after timer/motion


Whswede

Question

I have been looking around to find the simplest? solution to turn on a light triggered by a motion sensor but restarting the timer and I think my code is short enough but as I am no coder syntax is wrong. At least that's what I think. Code stolen and adapted from various places... (sorry if not allowed but where do a beginner start)

First my conditions

Quote

Please login or register to see this code.

 

 

then my actions

Please login or register to see this code.

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Strange that it is possible to save the scene with a double operator in the last condition.

Change the last part to

 

Please login or register to see this code.

 

and check your scene setting about allowing the restart of a running scene, yes (default) or no

 

  • Like 1
Link to comment
Share on other sites

  • 0
9 minutes ago, Whswede said:

Please login or register to see this code.

What is switch? I do not see it in your code.

 

11 minutes ago, Whswede said:

Please login or register to see this code.

Same question about timer

 

You mean this?

 

Please login or register to see this code.

 

I am not saying it is going to work, it might, but you say you are a beginner so let us get past the basic errors first.

  • Like 1
Link to comment
Share on other sites

  • 0

Change your line:

Please login or register to see this code.

to: local movement, modifytime = fibaro.get(motion1, "value")

 

or: local movement = fibaro.getValue(motion1, "value")

 

or without the local variable movement just say:  if  fibaro.getValue(motion1, "value") then horntimer = ..... etc.

 

  • Like 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • On 12/5/2022 at 8:40 PM, petergebruers said:

    What is switch? I do not see it in your code.

     

    Same question about timer

     

    You mean this?

     

    Please login or register to see this code.

     

    I am not saying it is going to work, it might, but you say you are a beginner so let us get past the basic errors first.

    Great! It kinda works now :)

    Code looks like this now. (removed condition on id 90 temporary)

    Please login or register to see this code.

     

    Adjusted the actions. Switch is replaced by light1. 

    Please login or register to see this code.

     

    I also adjusted the local value movement

    BUT the code does not seem to be triggered by the motion sensor. I can run the code manually and it loops fine and turns the light off if no movement but i never lights up again. I solved it temporarily by adding a simple block scene that runs this LUA-scene whenever motion is detected. Scene is set to run auto and not disabled. What is missing for it run triggered by sensor ID193 ?

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