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] Memory Usage Monitoring and Auto Reboot


Dave_H
 Share

Question

Like many others here, I'm frequently plagued by periodic crashes and 503 errors.  In my case, I noticed that the memory usage would increase dramatically, to the point where scenes would no longer run, and the web interface wouldn't respond.  Only a restart would fix it.  I traced it to what I can only think is a memory leak, and I have a suspicion that it's related to the Heating/Cooling Panels.  It might be fine for a while, and then for a week or so, I'll get the memory leak problem occur again.  I can't be 100% sure, but I'm coming to conclusion that this happens after I've updated the Heating Panel.

 

So I wrote this scene to monitor the memory usage and to automatically reboot the HC2 if the usage exceeds a specified value.  I also have it writing the memory usage values off to AllThingsTalk, so that I can see the history, like this:

 

Please login or register to see this attachment.

 

For more details of AllThingsTalk, then see this post: 

Please login or register to see this link.

 

Disclaimer: Only use this scene if your system is generally stable but occasionally has a memory problem, otherwise you might send your system into a continuous reboot loop.  Please use this scene at your own risk.  Only use it if you know what you are doing.

 

Memory Monitor.lua

Please login or register to see this code.

 

If you don't want to mess around with setting up AllThingsTalk, then here is a second version without this functionality:

Please login or register to see this code.

 

The scene is triggered every 5 minutes by a global variable.  See 

Please login or register to see this link.

 or 

Please login or register to see this link.

 for examples of how use a timer global variable.

 

The scene is currently set to reboot when the memory usage exceeds 70%.  There is still the possibility that if the memory usage is increasing at a very high rate, then the HC2 will crash before the scene next runs.  So setting it to 70% seems to be low enough to catch most instances.  Do not set this to a low value otherwise your HC2 might go into a continuous reboot loop.  Take a look at your normal RAM usage in the Diagnostics Panel and use a value higher than this.

 

You will need to change the line of code that specifies the Mobile Device Id which should receive the notification message when the memory limit is exceeded.  You can find the device id from the API.  Enter the following URL into a browser:

Please login or register to see this code.

This will return a list of the mobile devices and you can select the appropriate one.

 

You'll also need to assign the correct values to the AllThingsTalk ClientID, ClientKey and AssetId if you're using the first version of the scene.  You can get all these values from the Maker pages of AllThingsTalk.com.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.

 Share

×
×
  • Create New...