Package: combilog
combilogA tool to interact with the combilog datalogger by Theodor Friedrichs. Currently only the combilog 1022 is supported.Installationpip install combilogUsageRead the logger and save as csvimportcombilogimportcsv# initialize a `combilog` objectmy_log=combilog.Combilog(logger_addr=1,port='com6')# authenticate if neededmy_log.authenticate(passwd='12345678')# set pointer 1 to the start of the memory to read the loggermy_log.pointer_to_start(pointer=1)# read the logger specify wich pointer to uselogs=my_log.read_logger(pointer=1,verbose=True,output_type='list')# export as csvwithopen('logs.csv','w',newline='')asf:writer=csv.writer(f)# write headerHEADER=['timestamp','channel_1','channel_2',...,'channel_n']writer.writerow(HEADER)foriinlogs:writer.writerow(i)Read the logger and assign to a pandas DataFrameimportcombilogimportpandasaspd# initialize a `combilog` objectmy_log=combilog.Combilog(logger_addr=1,port='com6')# authenticate if neededmy_log.authenticate(passwd='12345678')# set pointer 1 to the start of the memory to read the loggermy_log.pointer_to_start(pointer=1)# read the logger specify wich pointer to use. output_type is `dict` for# the pandas dataframelogs=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 portOn 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 deviceYour port isttyACM0On windows simply check the device-manager for a com portNotesThe logger manual can be foundhere. TheASCIIprotocol 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.@retrydecorator might be usefulMy UsageI 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.TestsMost of the tests unfortunatelly depend on a logger beeing connected tocom6.The tests were ran using aCombilog 1022withhw_version=V4.01andsw_revision=2.26The logger settings used for testing can be found intesting/tetsing.PROthe requirements for testing inrequirements-dev.txtthe 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%