Skip to content

Commit

Permalink
Initial implementation of the protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
Krolken committed Jun 4, 2019
1 parent be6e298 commit 07042e5
Show file tree
Hide file tree
Showing 17 changed files with 2,229 additions and 21 deletions.
22 changes: 22 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,22 @@
version: 2.1

jobs:
build:
working_directory: ~/work_dir
docker:
- image: circleci/python:3.6.8 # every job must define an image for the docker executor and subsequent jobs may define a different image.
steps:
- checkout # checkout source code to working directory
- run:
command: |
python -m venv venv
. venv/bin/activate
pip install -r requirements.txt
pip install -e .
- run:
command: |
. venv/bin/activate
pytest -v --cov=iec62056_21
coveralls
15 changes: 15 additions & 0 deletions .coveragerc
@@ -0,0 +1,15 @@
[run]
branch = True

[report]
exclude_lines =
if self.debug:
pragma: no cover
def __repr__
raise NotImplementedError
raise NotImplemented
if __name__ == .__main__.:
pass
ignore_errors = True
omit =
*migrations*, *tests*
27 changes: 27 additions & 0 deletions HISTORY.md
@@ -0,0 +1,27 @@

# Changelog


The format is based on `Keep a Changelog: https://keepachangelog.com/en/1.0.0/`,
and this project adheres to `Semantic Versioning: https://semver.org/spec/v2.0.0.html`


## Unreleased

### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security


# v0.0.1 (2019-06-04)

Initial implementation of IEC 62056-21 with focus on supporting LIS 200 derivative
protocol.
3 changes: 0 additions & 3 deletions HISTORY.rst

This file was deleted.

92 changes: 90 additions & 2 deletions README.md
@@ -1,5 +1,93 @@

# IEV62056-21
# IEC 62056-21


A Python library for IEC62056-21, Local Data Readout of Energy Meters. Former IEC1107
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.

* At the moment we only support Mode C.
* We assume that only protocol mode Normal is used.

## Example usage:

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

```python
from iec62056_21.client import Iec6205621Client

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

password_challange = client.access_programming_mode()

client.send_password('00000000') # Common standard password

data_answer = client.read_value('1.8.0')

```

```python
from iec62056_21.client import Iec6205621Client

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

password_challange = client.access_programming_mode()

client.send_password('00000000') # Common standard password

data_answer = client.read_value('1.8.0')

```


## 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](https://docs.utilitarian.io)

## Contributing

* Check for open issues or open a fresh issue to start a discussion around a feature
idea or a bug.
* Fork the repository on GitHub to start making your changes to the master branch (or
branch off of it).
* Write a test which shows that the bug was fixed or that the feature works as expected.
* Send a pull request and bug the maintainer until it gets merged and published.

0 comments on commit 07042e5

Please sign in to comment.