pwitab / iec62056-21

A Python library for IEC62056-21, Local Data Readout of Energy Meters. Former IEC1107
BSD 3-Clause "New" or "Revised" License
69 stars 21 forks source link
amr metering smart-grid smart-meter smart-meters

IEC 62056-21

CircleCI Coverage Status

A Python library for IEC 62056-21, Direct Local Data Exchange of Energy Meters. Former IEC 61107 or IEC 1107

Installation

We only support python 3.6+

Install via pip:

pip install iec62056-21

About IEC 62056-21

IEC 62056-21 (earlier IEC 61107 or sometimes just IEC 1107, is an international standard for a computer protocol to read utility meters. It is designed to operate over any media, including the Internet. A meter sends ASCII (in modes A..D) or HDLC (mode E) data to a nearby hand-held unit (HHU) using a serial port. The physical media are usually either modulated light, sent with an LED and received with a photodiode, or a pair of wires, usually modulated by a 20mA current loop. The protocol is usually half-duplex.

Limitations of this library.

Example usage:

Reading a meter using a optical usb probe via the D0-interface.

from iec62056_21.client import Iec6205621Client

client = Iec6205621Client.with_serial_transport(port='/dev/tty_something')
client.connect()
print(client.standard_readout())

Reading a meter over an internet connection.

from iec62056_21.client import Iec6205621Client

client = Iec6205621Client.with_tcp_transport(address=('192.168.0.1', 8000), device_address='12345678', password='00000000')
client.connect()
print(client.standard_readout())

Derivative protocols

Some manufacturer are using a derivative protocol to IEC 62056-21. They comply with most things but might for example not use the access request features according to standard or they have a slightly different flow in command execution

This library can be used with some of them. You just need to be aware of the differences. We provide special handlers for some unique parts that is included in this library. They might be split into separate libraries in the future.

LIS-200

A protocol for Elster devices. Main difference is that they have the concept of locks instead of password and instead of answering the password request you need to write the password to a certain register.

Development

This library is developed by Palmlund Wahlgren Innovative Technology AB in Sweden and is used in our multi utility AMR solution: Utilitarian

Contributing