A tool to interact with the combilog by Theodor Friedrichs.
Project description
combilog
A tool to interact with the combilog datalogger by Theodor Friedrichs. Currently only the combilog 1022 is supported.
Installation
pip install combilog
Usage
Read the logger and save as csv
import combilog
import csv
# initialize a `combilog` object
my_log = combilog.Combilog(logger_addr=1, port='com6')
# authenticate if needed
my_log.authenticate(passwd='12345678')
# set pointer 1 to the start of the memory to read the logger
my_log.pointer_to_start(pointer=1)
# read the logger specify wich pointer to use
logs = my_log.read_logger(pointer=1, verbose=True, output_type='list')
# export as csv
with open('logs.csv', 'w', newline='') as f:
writer = csv.writer(f)
# write header
HEADER = ['timestamp', 'channel_1', 'channel_2', ..., 'channel_n']
writer.writerow(HEADER)
for i in logs:
writer.writerow(i)
Read the logger and assign to a pandas DataFrame
import combilog
import pandas as pd
# initialize a `combilog` object
my_log = combilog.Combilog(logger_addr=1, port='com6')
# authenticate if needed
my_log.authenticate(passwd='12345678')
# set pointer 1 to the start of the memory to read the logger
my_log.pointer_to_start(pointer=1)
# read the logger specify wich pointer to use. output_type is `dict` for
# the pandas dataframe
logs = my_log.read_logger(pointer=1, verbose=True, output_type='dict')
df = pd.DataFrame.from_dict(data=logs, orient='index')
print(df.head(3))
Finding the right port
- On Linux you can check for the used port using dmesg | grep -E 'tty|usb'
- you are likely to see something like this at the bottom:
[202789.491199] usb 1-1.1.2: New USB device found, idVendor=eb03, idProduct=0920, bcdDevice= 1.10
[202789.491213] usb 1-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[202789.491223] usb 1-1.1.2: Product: CombiLog 1022
[202789.491232] usb 1-1.1.2: Manufacturer: Th.-Friedrichs
[202789.640236] cdc_acm 1-1.1.2:1.0: ttyACM0: USB ACM device
- Your port is
ttyACM0
- On windows simply check the device-manager for a com port
Notes
- The logger manual can be found here. The
ASCII
protocol this package uses is described starting at page 118. - Sometimes setting the pointer fails the first time and it is successful the second time, so a e.g.
@retry
decorator might be useful
My Usage
I personally use this for my private weatherstation. The logger is connected via USB to a Raspberry Pi running a basic rasbian. Every 5 minutes when a log was written I fetch the data from the logger and save it directly to PostgreSQL database.
Why should I use this code?
The intention for writing this code was the lack of affordable options offered by Theodor Friedrichs for automatically downloading the data from the datalogger. Also there still is no software for Linux or for servers without a GUI. This script should run on all of them, they just need python3. This software should do what the automatic part of the expensive Comgraph software does which only runs on windows and is obviously not free.
Tests
- Most of the tests unfortunatelly depend on a logger beeing connected to
com6
. - The tests were ran using a
Combilog 1022
withhw_version
=V4.01
andsw_revision
=2.26
- The logger settings used for testing can be found in
testing/tetsing.PRO
- the requirements for testing in
requirements-dev.txt
- the test coverage is not 100 % because some exceptions cannot be triggered manually and also the transparent mode cannot be tested since no logger network is available for testing.
----------- coverage: platform win32, python 3.7.7-final-0 -----------
Name Stmts Miss Cover
---------------------------------
combilog.py 309 18 94%
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file combilog-2.0.1.tar.gz
.
File metadata
- Download URL: combilog-2.0.1.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e0eaaef31f5b84b266efe50119016bed9df18985c0197f4df055fc4a716359e |
|
MD5 | 34ac2fabaa4b9943c7c8fe4d1b363644 |
|
BLAKE2b-256 | f918f9201e7c89d95d2b0c14668b1f6f042b0fcc551c336082ebe3bf0930c666 |
File details
Details for the file combilog-2.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: combilog-2.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09a2bb50994a515e474192e224dcfade8a3cdbba6d04b92f0200810ecbcd3117 |
|
MD5 | 4c55890816f2275bfb83a5a1dc70b8c7 |
|
BLAKE2b-256 | 82f0ac7f871d3858e38010280b2686698e6f40d927f30b819381c0435c5b9fac |