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 (edited)

Hi Everyone

 

SmplLog 1.1 (aka Simple Logger)

 

NOTE - Changelog from 1.0 to 1.1 includes better support for popups (Type can be defined and different use of Title and SubTitle)

Upgrade from 1.0 to 1.1 - Simple drop in new scene code below and change target to what you use.

 

I created this scene to track the behavour of my own system and decided to share as other users may get use from it.

PREFACE - This uses the Smart Message Hub in its published form but could easily be modified to send the log direct to a notification service


This scene will log entries with a time stamp and send them to a user defined notification service as one batch. The scene was designed to 
track debug type events/notices/data that you may review daily or periodically. It can even be used as you debug a new scene and may want

to read sensor data every x minutes and provide the result back as one email/notification

Overall, its designed to keep the clutter out of your primary notification services and give you a batch notification of some event
  
Most notification services have a limit of characters and this is configurable in the scene below. Once this max limit has been reached the log entries 
will send to the defined target as a batch. The batch notification has a title of the day and a time range from the first entry to the last.

The following is an example of the log being sent via HC2 email

 

Please login or register to see this attachment.

      

Please login or register to see this attachment.

     

Please login or register to see this attachment.


  
-> To invoke from a scene simply add the following..
    fibaro:startScene( jT.sc.SmplLog, {"message text you want to send"})

                            or 

   fibaro:startScene( 705, {"message text you want to send"})
 

INSTALLATION AND CONFIGURATION ( very little configuring with this one)

1) Copy code into new scene. It will create a global variable and then after a number of seconds will initialise the log table

 

Please login or register to see this attachment.

 

2) Comment out/in the usual HomeTable reference as you require

2) Set deBugVar = true of you want to see the messages are they are being logged

3) Define your target notification (as this uses the Smart Message Hub, the target names should match whats in your SMsgH 1.1)

     -> The scene is setup to send to HC2 superuser by default

4) Add the Logging Invocation above to whatever seen you want

.. and that's it !!

 

I have also included a Demo Scene that will allow you to see the scene working.

It logs 29 log entries in succession and will invoke the log batch notification after 27 entries as it will have reached the max characters at that stage

A second command is in the demo scene that allow you to send/reset the log at will. (see secondary option below for use of this)

 

Smpl log scene code ------------> 

Please login or register to see this attachment.

Smpl Log demo code -----------> 

Please login or register to see this attachment.

  {see below for instructions}

 

 

suggested icon

 

Please login or register to see this image.

/monthly_2017_04/log.png.bd05115d4d14ad73f30f37fbf5bec6c1.png" />         58e77c489a98a_smpldc.PNG.1fa07765ecbbba08b261de505a108e9c.PNG

 

-Enjoy

 

 

 

Additional Information/Options

Demo Scene

Scene code included to create a scene that will demo the capability by sending over 1000 characters to the log and this will cause it to auto-send and empty and start again

Very easy to use, comments on in the code file below

 

Adjusting the max length of characters that can be logged (at your own risk  ;-) )

I have set the maximum characters as follows (lenMax = 950) as this appears to the largest number that can be handled by one HC2 email 

or a single pushover notification can handle.

-> hc2email: approx max chars of 1000 allowed. If this is exceeded, the  email is NOT sent
-> pushover: Limited to approx 1000 chars and if this is exceeded, it is sent as a series of pushover notifications

 

Setting up as a Daily Log

You can use @Sankotronic Main Scene to invoke this send log on demand at a certain time. I send it every night at 23:59.

You can set this up as follows....

 

Step 1-6 is the normal setup 

Step 7 - This is a new addition to the Main Scene code

Please login or register to see this attachment.

 

Step 7 code

Please login or register to see this code.

 

Step 8 is a modification of the code (the existing code is commented out above the required code)

Please login or register to see this attachment.

 

Step 8 code 

Please login or register to see this code.

 

 

 

 

 

 

 

 

 

Edited by AutoFrank

11 answers to this question

Recommended Posts

  • 0
Posted

Hey @AutoFrank, again a nice solution!

 

This one goes on my ever expanding todo list. I don't think I'll need a complete log, but one that stores breaches when the house alarm is armed.

 

Thanks and have a nice weekend!

  • 0
  • Inquirer
  • Posted
    19 minutes ago, jimicr said:

    again a nice solution!

     

    Thanks @jimicr

     

    It may also be helpful if you wanted to track some data (say temp or breach) over a period of time and present it back to you in one message

    For me its more about tracking background tasks (clock sync, equipment rack cooling, etc) that I can check if I have an issue or if I'm troubleshooting an issue.

    We recently had an issue with temp in our dining room. It was dropping a little but I wasn't too sure if it was all down to the window being open for 20 minutes in the morning or through out the day. I wrote a small vd that checked the temp every 30 mins and wrote the result to the smpl logger. I could then see very easily how the temp tracked over the course of the day. 

     

    enjoy the weekend

    -f

    • 0
    Posted
    2 minutes ago, AutoFrank said:

     

    Thanks @jimicr

     

    It may also be helpful if you wanted to track some data (say temp or breach) over a period of time and present it back to you in one message

    For me its more about tracking background tasks (clock sync, equipment rack cooling, etc) that I can check if I have an issue or if I'm troubleshooting an issue.

    We recently had an issue with temp in our dining room. It was dropping a little but I wasn't too sure if it was all down to the window being open for 20 minutes in the morning or through out the day. I wrote a small vd that checked the temp every 30 mins and wrote the result to the smpl logger. I could then see very easily how the temp tracked over the course of the day. 

     

    enjoy the weekend

    -f

    Indeed, it can be used as a troubleshooter aswell.

    Didn't think of that!

     

    Great call!!

    • 0
    Posted

    I think I have a purpose for this.. I currently use Popup Notifications to track Automation decisions in the system (using your Message Hub of course!), things like the Washing Machine, Bath Filling, Heating Enhancements, Radio Wakeup, Alarm setting and stuff.. Its great, but I am already fed up with closing off 25 Popups a day..

    I don't NEED the popups, it was just an audit..

    I reckon this will do just as good.

    Cheers

    Shaun

    • 0
  • Inquirer
  • Posted
    8 minutes ago, shaunfrost said:

    I think I have a purpose for this.. I currently use Popup Notifications to track Automation decisions in the system (using your Message Hub of course!), things like the Washing Machine, Bath Filling, Heating Enhancements, Radio Wakeup, Alarm setting and stuff.. Its great, but I am already fed up with closing off 25 Popups a day..

    I don't NEED the popups, it was just an audit..

    I reckon this will do just as good.

    Cheers

    Shaun

    Hi @shaunfrost

    That's exactly the same way I use it,,, :-D ...along with the odd troubleshooting check,,

    Thanks for sharing 

     -f

    • 0
    Posted
    2 minutes ago, AutoFrank said:

    Hi @shaunfrost

    That's exactly the same way I use it,,, :-D ...along with the odd troubleshooting check,,

    Thanks for sharing 

     -f

    I timed it. for anyones interest it took me 4 minutes to install, and configure my first scene to log.

    should only take me another 30 mins to swap out all the message popups in the system with this line.

    Excellent!

    • 0
  • Inquirer
  • Posted
    4 minutes ago, shaunfrost said:

    I timed it. for anyones interest it took me 4 minutes to install, and configure my first scene to log.

    should only take me another 30 mins to swap out all the message popups in the system with this line.

    Excellent!

    :-D :-D

    14 minutes ago, shaunfrost said:

    I timed it. for anyones interest it took me 4 minutes to install, and configure my first scene to log.

    should only take me another 30 mins to swap out all the message popups in the system with this line.

    Excellent!

     

    Hi @shaunfrost

     

    You probably spotted this but the default target setting didn't work.

     

    Line 60 should have read

    Please login or register to see this code.

     I'll fix the first post as well

    sorry about that :oops:

     

    -f

    23 minutes ago, AutoFrank said:

    I don't NEED the popups,

     

    HI @shaunfrost

     

    It would be interesting to see whats the max number of characters you can use in a popup..

    this scene could also push to a popup if it held a decent amount

     

    -f

    • 0
    Posted (edited)
    On 4/8/2017 at 9:34 AM, AutoFrank said:

    It would be interesting to see whats the max number of characters you can use in a popup..

    this scene could also push to a popup if it held a decent amount

     

    -f

     

    I have some popups that are long and text can be scrolled inside the popup window but I haven't reach limit yet. :-) 

    I did a quick test and I send text 4578 characters long separated in 100 lines with CR (\n) and still didn't reach limit of contentBody! This is definitely longer than e-mail so I will send my battery check info to popup instead to e-mail.

     

    Edited by Sankotronic
    Attachment quota filled up / deleting older stuff sorry :-(
    • 0
  • Inquirer
  • Posted

    Hi Everyone,

     

    Quick upgrade of the Simple Logger 1.0 to 1.1

     

    NOTE - Changelog from 1.0 to 1.1 includes better support for popup notifications (Type can be defined and different use of Title and SubTitle)

     

    No benefit in upgrading if you don't plan on using popup notifications

     

    Still want to Upgrade from 1.0 to 1.1 - Simple drop in new scene code below and change target to what you use.

    ---> no other changes required and any data logged will be preserved

     

    Enjoy....

    -f

    • 0
    Posted
    On ‎08‎/‎04‎/‎2017 at 8:34 AM, AutoFrank said:

    :-D :-D

     

    Hi @shaunfrost

     

    You probably spotted this but the default target setting didn't work.

     

    Line 60 should have read

    Please login or register to see this code.

     I'll fix the first post as well

    sorry about that :oops:

     

    -f

     

    HI @shaunfrost

     

    It would be interesting to see whats the max number of characters you can use in a popup..

    this scene could also push to a popup if it held a decent amount

     

    -f

     

     

    Upgraded to 1.1, will see how the popups do :)

    Just a note, you don't mention in the setup that you might need to change line 111 and 114 to the HomeTable references for the MessageHub Scene in your own setup,  as mine it jT.scene.messagehub  

    Cheers

    Shaun

    • 0
  • Inquirer
  • Posted

    @shaunfrost

    ... oops :oops:. Good catch with the hometable reference 

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