Giter VIP home page Giter VIP logo

el4000's Introduction

Energy Logger 4000 utility

This project provides a utility which can be used to read info and binary logs from the Voltcraft Energy Logger 4000 as sold by Conrad. A setup file (setupel3.bin) can also be read and written, this allows you to configure the device via the SD card.

Requirements

To use this program, you will need the following:

  • A Python interpreter (version 2 or 3). Almost all Linux distributions have this already installed. For Mac OS X and Windows users, see Pythons download page.
  • (Recommended) A SecureDigital card to communicate with the EL4000. The EL4000 manual recommends a 4 GB card which which works fine for me.
  • (Recommended) A Voltcraft Energy Logger 4000. It should also work with a EL3500 since it has the same file format, but I could not test this.

This program has been tested with a Voltcraft Energy Logger 4000F (with a French power plug and a German adapter, bought via eBay) on a Dutch energy network.

Usage

Since this program is a console application, you need to open a terminal (or cmd) first. Available options:

$ python el4000.py --help
usage: el4000.py [-h] [-p {raw,base,watt,va,csv}] [-d DELIMITER] [-v]
                 [-s [key=value [key=value ...]]] [-o]
                 binfile [binfile ...]

Energy Logger 4000 utility

positional arguments:
  binfile               info or data files (.bin) from SD card. If --setup is
                        given, then this is the output file (and input for
                        defaults). The order of files are significant when a
                        timestamp is involved

optional arguments:
  -h, --help            show this help message and exit
  -p {raw,base,watt,va,csv}, --printer {raw,base,watt,va,csv}
                        Output formatter (default 'base')
  -d DELIMITER, --delimiter DELIMITER
                        Output delimiter for CSV output (default ',')
  -v, --verbose         Increase logging level (twice for extra verbose)
  -s [key=value [key=value ...]], --setup [key=value [key=value ...]]
                        Process a setupel3.bin file. Optional parameters can
                        be given to set a field (-s unit_id=1 for example). If
                        no parameters are given, the current values are
                        printed

Example: print time and watt as CSV

Given a data file A0810702.BIN, you can write a results.csv file with:

$ python el4000.py -p csv A0810702.BIN > results.csv

Its content may look like:

timestamp,voltage,current,power_factor
2014-06-27 13:13,237.1,0.215,0.420
2014-06-27 13:14,236.5,0.206,0.420
2014-06-27 13:15,235.7,0.199,0.420
2014-06-27 13:16,237.3,0.204,0.420
...

If you happen to see "1970-01-01" as timestamp, be sure to include the info files (102 bytes) before others (and use --data-only to hide the contents of this info file). Compare:

$ python el4000.py -p csv A07EF88B.BIN
timestamp,voltage,current,power_factor
1970-01-01 00:00,238.5,0.000,0.000
1970-01-01 00:01,239.5,0.000,0.000
...
$ python el4000.py -p csv --data-only A07EF88A.BIN A07EF88B.BIN
timestamp,voltage,current,power_factor
2014-06-25 16:53,238.5,0.000,0.000
2014-06-25 16:54,239.5,0.000,0.000
...

Example: show information file

The information file is 102 bytes, its contents can be examined just like a data file:

$ python el4000.py A0810701.BIN
header_magic                        b'INFO:'
total_power_consumption             0.534 kWh
total_recorded_time                 2119h 04m
total_on_time                       2115h 15m
total_kwh_today_min_0               0.1 kWh
...
total_kwh_today_min_9               0.0 kWh
total_recorded_time_today_min_0     3h 42m
...
total_recorded_time_today_min_9     0h 00m
total_on_time_today_min_0           3h 42m
...
total_on_time_today_min_9           0h 00m
unit_id                             0
tariff1                             0.221
tariff2                             0.227
init_time_hour                      16
init_time_minute                    53
init_date_month                     6
init_date_day                       25
init_date_year                      14
end_of_file_code                    b'\xff\xff\xff\xff'

Example: configure setup file

The available setup options and values can be displayed with the the --setup option (or its abbreviation, -s). Example:

$ python el4000.py setupel3.bin --setup
header_magic    b'\x00\x00\x00'
unit_id         0
hour_format     0
date_format     0
time_hour       0
time_minute     0
date_month      0
date_day        0
date_year       0
currency        0
tariff1         0.0
tariff2         0.0

To actually set values, specify one or more options to --setup. Definitions can be found in the file defs.py. Overview of options:

  • unit_id: ranges from 0 to 9.
  • hour_format: 1 for 12h format, 2 for 24h format.
  • date_format: 1 for mm/dd/yy, 2 for dd/mm/yy display.
  • time_* and date_*: set the initial clock. Note that date_year is in abbreviated form. Instead of 2014, use 14.
  • currency: 1 for £, 2 for Sfr, 4 for $ and 8 for
  • tariff, tariff2: ranges from 0.000 to 9.999.

To modify (or create) the setupel3.bin file for a 24h clock, dd/mm/yy date format and euros, use:

$ ./el4000.py setupel3.bin -s hour_format=2 date_format=2 currency=8
Changing hour_format from 0 to 2
Changing date_format from 0 to 2
Changing currency from 0 to 8
WARNING:Format:Invalid value 0 for name date_month
WARNING:Format:Invalid value 0 for name date_day
Setup file:  setupel3.bin
header_magic    b'\xb8\xad\xf2'
unit_id         0
hour_format     2
date_format     2
time_hour       0
time_minute     0
date_month      0
date_day        0
date_year       0
currency        8
tariff1         0.0
tariff2         0.0

Contact

If you have issues, questions, ideas or suggestions, feel free to contact me at [email protected] or open a ticket at https://github.com/Lekensteyn/el4000/. Pull requests are also welcome.

Copyright

Copyright (C) 2014 Peter Wu

Energy Logger 4000 utility is licensed under the MIT license. See the LICENSE file for more details.

Links

el4000's People

Contributors

lekensteyn avatar

Stargazers

 avatar  avatar kompotmalinowy avatar  avatar Alexey Vazhnov avatar Uffe Jakobsen avatar jumpjack avatar  avatar Nik avatar Jérôme Lafréchoux avatar Lech Perczak avatar David Guyon avatar  avatar Michal Valoušek avatar Adrien Mahieux avatar Alek Malaszkiewicz avatar Krzysztof Szularz avatar

Watchers

 avatar James Cloos avatar Roger avatar  avatar  avatar

el4000's Issues

Spurious 0xff after timestamp (EL3500)

Having been a Linux guy for the past 25 years, I was very happy to find this code, which made it possible to read out an EL3500 that had been purchased about ten years ago (I still have a 512MB SDcard for it). Thank you!

After successfully recording over 4 days, and reading out the internal memory of my logger daily, I this morning found some very high wattage values reported by el4000.py.

A closer inspection showed that there had been two startcodes (nothing unusual), and following the second one and the corresponding timestamp, there was an extra 0xff byte inserted, This kind of desynchronisation obviously caused the nonsensical values.

Not very familiar with Python programming, I had to doctor the file using an editor - and removing the extra byte put me back on track, with completely sensible values. Phew ;)

Did this happen to others as well? Would it be correct to ignore any 0xff bytes in front of any 5-byte record? Is it perhaps too late to ask for a patch? - Thanks.

(I seem to be unable to upload the file in any format allowed. Please advise how to provide it.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.