Project

General

Profile

Support #132

Improved Open-ZWave wrapper logging

Added by Alexie about 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
05/18/2012
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

Hi Ron,

I am debugging de HSM100 sensor and i noticed that the Open-ZWave wrapper debugging logging isn't easy readable, mainly because a date/time is missing in the output. I patched the most recent Open ZWave wrapper and attached it to this incident.

The output now looks like:
Fri May 18 13:37:06 2012 OZW DriverReady: HomeId=21824000 Node=1

Fri May 18 13:37:07 2012 OZW AddNode: HomeId=21824000 Node=1

Fri May 18 13:37:07 2012 OZW ProtocolInfo: HomeId=21824000 Node=1
Fri May 18 13:37:07 2012 OZW Basic=2
Fri May 18 13:37:07 2012 OZW Generic=2
Fri May 18 13:37:07 2012 OZW Specific=1
Fri May 18 13:37:07 2012 OZW Cap=0
Fri May 18 13:37:07 2012 OZW Security=0
...

When i have the HSM100 99-100% working, i will also supply the code-fixes (currently debugging the wait-up events, because then we needs to send a get request for temperature/light).

Regards,
Alex

DomoZWave.cpp (28.9 KB) DomoZWave.cpp Alexie, 05/18/2012 01:49 PM

History

#1 Updated by rdnzl about 7 years ago

Thanks, I added your code to version 0.1.206, would be even better if it had the same date format as the OZW_Log format, but couldn't find how to change it easily.

#2 Updated by rdnzl about 7 years ago

  • Status changed from New to Feedback

#3 Updated by Alexie about 7 years ago

Hi Ron,

To get the same format as the OZW_log.txt, just add the following include to the wrapper:
#include <sys/time.h>

And replace the "OZW_datetime" with the following routine:

ostream &OZW_datetime(ostream &stream)
{
  // Get a timestamp
  struct timeval tv;
  gettimeofday(&tv, NULL);
  struct tm *tm;
  tm = localtime( &tv.tv_sec );

  // create a time stamp string for the log message
  char localt[100];
  snprintf( localt, sizeof(localt), "%04d-%02d-%02d %02d:%02d:%02d:%03d",
            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
            tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec / 1000 );

  stream << localt << " OZW ";

  return stream;
}

Now it is the same as the Open Z-Wave format :-)

Gr.
Alex

#4 Updated by Alexie about 7 years ago

Hi Ron,

Can you change a few things in the DomoZWave.cpp?

When i was using 0.1.204 i got much Z-Wave logging in the "OZW_log.txt", in 0.1.205 you changed the Init a little bit, removing the useful detailed logging for troubleshooting Z-Wave devices.

Can you change the following from:

Options::Get()->AddOptionInt("SaveLogLevel", LogLevel_Error );
to:
Options::Get()->AddOptionInt("SaveLogLevel", LogLevel_Detail );

Also if possible, can you re-direct the OZW logging ONLY to "OZW_log.txt", because now i get it in 2 places, which makes it less handy on the standard output of domotiga. Change is also simple from:

Options::Get()->AddOptionBool("ConsoleOutput", true);
to:
Options::Get()->AddOptionBool("ConsoleOutput", false);

Gr.
Alex

#5 Updated by rdnzl about 7 years ago

  • Status changed from Feedback to In Progress

Will fix this too, I played with some of the newer API calls, but it wasn't better than we had before.

#6 Updated by Alexie about 7 years ago

Thanks :-) Will make my upgrades easier (and debugging the Open Z-Wave :P )

#7 Updated by rdnzl about 7 years ago

Fixed in r883.

#8 Updated by rdnzl about 7 years ago

  • Status changed from In Progress to Feedback

#9 Updated by Alexie about 7 years ago

Hi Ron,

I have tested it and it works fine.

Regards,
Alex

ps. i will submit a new version of the wrapper, with some additional features and fixes.

#10 Updated by rdnzl about 7 years ago

Ok all code is welcome ;-)

#11 Updated by rdnzl about 7 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF