浏览代码

Added readme

Stan Janssen 6 年之前
父节点
当前提交
c0899b65bc
共有 1 个文件被更改,包括 50 次插入0 次删除
  1. 50 0
      README.md

+ 50 - 0
README.md

@@ -0,0 +1,50 @@
+# Energymeter Python Module
+
+This is a Python module that implements the communication to several electricity meters and related equipment.
+
+At the moment, the following meters are supported:
+
+* ABB B21, B23, A43 and similar ABB meters (Modbus Serial)
+* SMA SunnyBoy (Modbus TCP)
+* MultiCube meters
+
+Some base classes are also provided for you to implement new meter variants.
+
+## Installation
+
+```
+git clone https://gitlab.com/elaad/energymeter
+cd energymeter
+pip3 install .
+```
+
+## Usage
+
+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.
+
+