Stan Janssen ddd69facbc Various improvements | 2 years ago | |
---|---|---|
README.md | 6 years ago | |
energymeter.py | 2 years ago | |
setup.py | 4 years ago |
This is a Python module that implements the communication to several electricity meters and related equipment.
At the moment, the following meters are supported:
Some base classes are also provided for you to implement new meter variants.
git clone https://gitlab.com/elaad/energymeter
cd energymeter
pip3 install .
To read all registers from a meter:
from energymeter import ABBMeter
meter = ABBMeter(port="/dev/ttyS0", baudrate=38400, slaveaddress=1, type="B23")
data = meter.read()
This returns a dictionary with all key-value pairs of data.
To read a single register:
data = meter.read('current_l1')
This returns just the value (usualy a float or int).
To read multiple registers:
data = meter.read(['current_l1', 'voltage_l1_n'])
This returns a dictionary with the requested keys and values.