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


Question

Posted

Hi

 

I came up to the function logbug(color, message) which is used in devices of @Sankotronic but I have seen it in many scenes.

Can someone explain what the function does except the debug colors?

 

Please login or register to see this code.

 

3 answers to this question

Recommended Posts

  • 0
Posted (edited)
32 minutes ago, Twannie said:

Can someone explain what the function does except the debug colors?

It replaces characters in the string that have special meaning in html. It does that because the output window of the "debug" statement is actually a piece of html encoded text. As long as you print simple things like "3.14" you won't notice anything, because most parts of html specification match "unicode characters" (which matches big part of ASCII encoding).

 

Those characters are:

 

Please login or register to see this code.

And also handles carriage return and line feed. The \xyz is "Lua octal encoding".

 

It uses Lua's "regular expressions" to match and substitute those characters (bytes):

 

Please login or register to see this link.

Edited by petergebruers
  • Thanks 1
  • 0
  • Inquirer
  • Posted

    Thank you @petergebruers!!!

    This helps ?

    I don't know how to close this question or mark as "has best answer" ?

    • 0
    Posted

    In addition to this: @petergebruers  I converted the battery check code code of @Sankotronic  to HC3. It works fine but i get some output which comes from this LogBug Function. I tried to fix it, but i have trouble finding out why i get the NIL output. Do you have a clue?

     

    Here is the output

    [? INFO! ID: 23 - MOTIONVERANDAVOOR (VERANDA VOOR) BATTERIJ IS OP 100 %]: nil

    [? INFO! ID: 29 - DEURKEUKENSMAL (KEUKEN) BATTERIJ IS OP 85 %]: nil

    [? INFO! ID: 33 - DEURWOONKAMER (WOONKAMER) BATTERIJ IS OP 100 %]: nil

    [️ INFO! ID: 37 - DEURHAL (HAL) BATTERIJ IS OP 35 %]: nil

     

    @Twannie I hope you don't mind i use your thread for this, but i thought its is about the same function which may be an excuse....

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