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


Clear Debug & Catching Errors 2.0

   (1 review)

1 Screenshot

About This File

I have noticed that sometime scenes or virtual devices stuck without any visible error. Another observation, that when it happens I cannot see debug information/messages of the scene/VD. In addition the Chrome browser crushes - Ah, Snap.

  1. The idea behind this scene is to monitor debug text of all scenes and virtual devices (including all buttons, sliders and etc.) in the system. In case the length of all messages over 40.000 characters, the scene clears the buffer.
  2. Since the code already reads debug messages, it checks the last message and if there is an error message (scene or virtual device) the code sends email to administrator with an error description.
    • Note: In case of error the messages are not deleted! The purpose of that is to keep the error for user review and debugging.
  3. Currently this scene runs every 300 sec. (5 minutes) . In order to set different time, please change sleepTime variable. (sleepTime = xxx)Capture.PNG.5a971fecd44b559615c1dffdd1d10b74.PNG
  4. By default scene clears debug buffer over 40.000 characters. In order to set different default length, please change txtLen variable. (txtLen = xxxxxx)
  5. In addition you have an option to set max. debug buffer length to any size for any scene or virtual device and its buttons. To do so please update  txtLenTbl table as follow:
    • Since the system could use same ID for VD and scene,  this table has two elements of arrays,  VD (vdLen)  and scene (sceneLen)
      •       
        local txtLenTbl = { 
                    vdLen = {{30000,"|618|615b12|515b3|"}, {35000,"|134|163b13|"} },                     
                sceneLen = {{35000,"|25|"},{30000,"|17|545|"} },
                          }
        --[[
        Vitual Device table elemnt:
        1st param. 30000 is the desired buffer length size.
        2nd param.  "|618|615b12|515b3|" is the list of VD ids and button number separated by "|". 
        For main loop use device ID only, for VD's button use button number same as in fibaro:call(VDid, "pressButton", button_num) function. 
        For example:
        618 - means Virtual device id 618 main loop.
        615b12 - means Virtual device id 615 button number 12.
        
        
        Scene table element:
        1st paraam. 35000 is the desired buffer length size.
        2nd param.  "|34|25|" is the list of scene ids separated by "|".
        
        You can defined as many arrays as needed.
        --]]

         

  6. The scene designed to run automatically, so please set "Max. running instances:"  to 3 and "Run scene:" to automatic.  Capture.PNG.9aa2d225c84db71e631cdd1aa4ba36c1.PNG. When the buffer cleared, the name of that scene/VD  will be displayed at scene's debug window.
  7. This code should find all scenes and Virtual devices (including all buttons, sliders and etc.) at the system. To make sure that everything has found at your system, please press "Start" button Capture.PNG.aa4982cc3ca004bcd5526f55f3145d33.PNG to run second instance of scene. This "one-time" instance  will be executed without loop. Means only one instance of automatic loop could be exist. After second instance execution you should see on scene's debug window printout of every scene/VD/VD button. its current buffer length size and max. allowed buffer size.
  8. Since this code runs in my system I didn't get any stuck issues and has successfully caught few unexpected errors in the scenes and VDs.
  9. I don't know if it somehow related to system freeze problem, but since this code runs I don't have system freeze or any CPU overloads. Hope it helps...

 


What's New in Version 2.0   See changelog

Released

New improvements:

 added ignoreErr global variable to define devices/scenes on which error will be ignored and not reported.

ignoreErr = "|525|597|535b1|"

To define virtual device button, use <deviceID>b<button number>.

See example above "535b1". Ignore error in virtual device 535 button number 1.



User Feedback

You may only provide a review once you have downloaded the file.


AR27690

  

An excellent way to catch rare and infrequent errors. Very helpful to debug virtual devices.

Thanks

Link to review
×
×
  • Create New...