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

Scene always active, but not time based


Question

Posted
Hi guys!

 

When I was looking in my dashboard, I saw some scenes which are triggered by motion sensor, are always in running state, but I guess they shouldn't. So I guess I have a typo in my script, but I can't find it (I'm not a Lua expert).

The scenes are triggered by motion sensors only.

 

Maybe some great guys here can take a look at it.

The base of the script is coming from Fibaro UK (on their website), but it didn't worked for me completely. I modified it.

 

Don't get me wrong, the scenes are working great, that's not the problem, but maybe they uses resources they shouldn't use.

 

To understand my scenes the best I post all three scenes of my hallway, kitchen and bathroom.

 

I hope someone can take a look at my script and advise me.

 

 

Hallway ("Gang" in dutch):

 


Please login or register to see this code.



 

 

Kitchen ("Keuken" in dutch):

 


Please login or register to see this code.



 

 

Bathroom ("Badkamer" in dutch):

 


Please login or register to see this code.



 

5 answers to this question

Recommended Posts

  • 0
Posted

A script that contains "while" always has the potential to "keep running"... either in error or because it needs to check something repeatedly. I see "while ((motion == 0) and (lightsOn or heatingOn))". The code that loops has sleep(). I did not check if the logic is flawed, I just pinpoint where it happens. Anyway, because it contains sleep(), I don't think it causes CPU problems. Can you please have a look at the cpu usage? What difference does it make when you kill the running scripts?

  • 0
  • Inquirer
  • Posted

    Hi petergebruers!

     

    I was hoping you would reply on this

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" /> Thanks!

    I'll disable/kill them and look at the cpu usage.

     

    Maybe someone has some tips to optimize my scripts? Or maybe this is the best way

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

     

    Edit:

    It doesn't looks like it makes a significant difference when the scene's are disabled and killed.

    • 0
    Posted

    So you can confirm my idea, that this doesn't use a lot of CPU. Good. I think the "while" loop is fairly typical. You can run many of these loops in parallel (I guesstimate: tens of instances) without causing trouble. One might argue that fibaro:sleep(2000) or higher would work too, but I wouldn't bother.

    • 0
  • Inquirer
  • Posted

    Thanks for the response. I'm not worried about it anymore

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    • 0
    Posted

    So you can confirm my idea, that this doesn't use a lot of CPU. Good. I think the "while" loop is fairly typical. You can run many of these loops in parallel (I guesstimate: tens of instances) without causing trouble. One might argue that fibaro:sleep(2000) or higher would work too, but I wouldn't bother.

     

    Hi Peter, 

    Since I have you 

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

     

    I have about 5 or 6 'While true do" lua scenes and theya re not that complicated

    from what you said the HC2 can run these with no issues

     

    I have what looks like a climbing memory consumption that happens over night and I'm trying to track down the culprit..

    All scenes are running okay with no errors so I think have a glitch in one script

     

    Please login or register to see this link.

     

     

     

    Would you mind look at the following script and see if you think there could be an issue with it as it has a few loops, etc. It is one of more complicated ones that run all the time

    Please login or register to see this code.

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