Skip to main content

pre-commit.ci status codecov build

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 with hw_version = V4.01 and sw_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%

Metadata

Release files for combilog 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for combilog 2.0.1
File Size Uploaded
combilog-2.0.1.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for combilog 2.0.1
File Interpreter ABI Platform
combilog-2.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 17.8 kB

Release files / combilog-2.0.1.tar.gz

Download URL combilog-2.0.1.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7e0eaaef31f5b84b266efe50119016bed9df18985c0197f4df055fc4a716359e
BLAKE2b-256 checksum
How to use checksums
f918f9201e7c89d95d2b0c14668b1f6f042b0fcc551c336082ebe3bf0930c666
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / combilog-2.0.1-py2.py3-none-any.whl

Download URL combilog-2.0.1-py2.py3-none-any.whl
Size 8.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
09a2bb50994a515e474192e224dcfade8a3cdbba6d04b92f0200810ecbcd3117
BLAKE2b-256 checksum
How to use checksums
82f0ac7f871d3858e38010280b2686698e6f40d927f30b819381c0435c5b9fac
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page