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
kevin

Way to disable and enable debug in scenes and VD's

Question

Hi,

 

I want to create a debug variable with the values ON and OFF. When the value is ON then I want debug to be activated in all scenes and VD's and the opposite when the value is OFF.

 

But how can I incorporate this in all scenes?

 

Thank you in advance😁

Kevin

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0

Ex. by get and check value of variable or local at beginning of code scene, main loop, vd code in small function and use it on replace fibaro:debug

 

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites
  • 0
  • Inquirer
  • @drboss 

    Thank you for your quick answer.

     

    If I understand it correctly, I need to add this to every scene/vd.

    I also need to replace fibaro:debug(“xxx”) by mydebug (‘red’, ‘xxx’)

    Share this post


    Link to post
    Share on other sites
    • 0
    Posted (edited)

    I'm curious, what is possible reason to do so?

    Another way... you can create a scene that always deletes debug message from all scenes and VDs or keeps the messages.

    please refer to

     

    Edited by cag014

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • Thnx @cag014

     

    The reason that I want this is, is the same reason of the scene you mentioned😄. I don't want that the debug is full of lines and causes issues. But your scene is also perfect to do so.

     

    I only have 1 question, when I download version 1.2 the text file shows a lot of stuff in the header. Also a lot of \par in the code. I think there is an error here (see attached screenshot)

    Please login or register to see this attachment.

    Share this post


    Link to post
    Share on other sites
    • 0
    Posted (edited)

    Sorry old version...

    Please open with wordPad and copy to scene.

    Let me know if it is OK

    Edited by cag014

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • I download ClearDebugMsg_v1.2.txt

     

    Open it with Texteditor on my Mac (Texteditor is the Wordpad on Mac) but still the same 🤔

    Please login or register to see this attachment.

    Share this post


    Link to post
    Share on other sites
    • 0

    This is version with removed wrong coded for past in HC2 special characters:

    Please login or register to see this code.

     

    • Thanks 2

    Share this post


    Link to post
    Share on other sites
    • 0

    Probably because of .txt extension Mac opens as notepad...

    Please try below... pure text file

     

     

    Please login or register to see this attachment.

    • Thanks 2

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • Posted (edited)

    Thanks too the both of you 

    Edited by kevin

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • @cag014

    Is there a way to exclude a scene/VD from the scene? I get an error on a VD button but that button works without issues.

    Share this post


    Link to post
    Share on other sites
    • 0

    I will see what can I do..

    But why not to fix the error?

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • You don't necessarily have to adjust the scene for me, it was more a question of whether this functionality was already present in the scene.  

     

    I can't get the error resolved, I'm not a LUA expert (yet😄), but I'm going to contact the person who wrote the scene.  In addition, I have recently been experimenting with LUA (scenes and VDs), so if you ever release an update of the scene then this feature seems like a good addition to me.

    Share this post


    Link to post
    Share on other sites
    • 0

    @kevin

    Per your request, have released new version with option to define devices/scenes/VD to ignore error.

    Wait for fibaro approval. I believe it will be available soon.

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • Wow thanks for the quick update of the scene.

    Share this post


    Link to post
    Share on other sites
    • 0

    Looks like this will take a lot to approve the code...

    Please download below and let me know if it works

     

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

    Please login or register to see this code.

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

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

     

     

    Please login or register to see this attachment.

    Share this post


    Link to post
    Share on other sites
    • 0
    13 hours ago, cag014 said:

    Looks like this will take a lot to approve the code...

    Please download below and let me know if it works

     

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

    Please login or register to see this code.

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

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

     

     

    Please login or register to see this attachment.

    I tried this code but i get the following error

     

    [DEBUG] 22:32:52: 2020-04-01 22:32:52.485236 [ fatal] Unknown exception: /opt/fibaro/scenes/639.lua:147: unexpected symbol near '}'

    Share this post


    Link to post
    Share on other sites
    • 0

    Oops... my bad

     

    Try below

     

    Please login or register to see this attachment.

    Share this post


    Link to post
    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...