If you want to convert the logs of your FHEM installation from FileLog
to DbLog, you may use the excellent 98_FileLogConvert.pm
.
What's a bit inconvenient is that each logfile conversion needs to be started by hand. This is the issue, this Python tool solves: You provide it a list of logfiles and the conversion is done one by one automatically.
Why was this tool written in Python (not Perl as FHEM itself)? Because the author is just much more proficient and fast writing Python than Perl.
Usage:
$ ./fhem_auto_import2DbLog.py --help
usage: fhem_auto_import2DbLog.py [-h] [--host HOST] [--port PORT]
[--file-log-convert FILE_LOG_CONVERT]
[--retry-every-seconds RETRY_EVERY_SECONDS]
[--wait-before-read WAIT_BEFORE_READ]
file_list
positional arguments:
file_list A text file listing all the logfiles to convert, one
per line
optional arguments:
-h, --help show this help message and exit
--host HOST The Telnet host, your FHEM instance is listening to.
--port PORT The Telnet port to connect to.
--file-log-convert FILE_LOG_CONVERT
The FileLogConvert instance in FHEM that will be asked
to convert the logfiles.
--retry-every-seconds RETRY_EVERY_SECONDS
How long should I wait until trying again to start the
next conversion?
--wait-before-read WAIT_BEFORE_READ
How long shall the Telnet library wait before reading
any content back?
Example:
$ ./fhem_auto_import2DbLog.py ./list.txt --host 192.168.0.96
where list.txt should look like this (lines starting with a hashtag will be ignored):
FBDECT_19-2017.log
FHEMduino_PT2262_10_15-2016.log
#FHEMduino_PT2262_10_15-2017.log
BMP183_01-2017.log
speedtest-2017.log
IT_F0F0FF0FFF-2016.log
- FHEM SVN repository: 98_FileLogConvert.pm
- FHEM Wiki: https://wiki.fhem.de/wiki/FileLogConvert
- FHEM forum topic for FileLogConvert: https://forum.fhem.de/index.php/topic,66383.0.html
Hi!
Nice Code, helped me to save some time.
One issue: I inserted after line 18: time.sleep(4)
Because I run on an Raspberry and the respond was to slow and I got no response. So your code go on to the next file. With the wait between write and read I got save a response.
Thank you for sharing your code!
Best regards,
Burkhard