Metadata-Version: 2.1
Name: iflag
Version: 0.1.2
Summary: A Python library for the Itron / Actaris IFLAG and Corus protocol
Home-page: https://github.com/pwitab/iflag
Author: Henrik Palmlund Wahlgren @ Palmlund Wahlgren Innovative Technology AB
Author-email: henrik@pwit.se
License: BSD-3
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: attrs

# iflag

A Python library for the Itron / Actaris IFLAG and Corus protocol

## Installing

Install via pip, python 3.6+ only

```pip install iflag```

## About

iflag is a library focused on reading and writing data to devices using the IFLAG or 
Corus protocol. Mainly Itron / Actaris gas volume converters. Communication is done over 
TCP/IP

## Features

The library is now only focused on using Single Address Mode (SAM) of the Corus protocol
to access data. SEVC-D parameters of I-FLAG is not supported.

* Read parameters
* Write parameters
* Read databases (logs), event log not yet implemented

## Usage

- Good to know: There are several different float formats due to memory constraints in
    the protocol and device. All floats are handled as `decimal.Decimal` in Python to 
    not have float rounding errors.

### Read parameters:

```python

from iflag import CorusClient

client = CorusClient.with_tcp_transport(address=('localhost', 4000))
client.read_parameters(['datetime', 'index_unconverted', 'index_converted'])

```

### Write parameters

```python
from iflag import CorusClient, TcpTransport
from datetime import datetime
transport = TcpTransport(address=('localhost', 4000))
client = CorusClient(transport=transport)
client.write_parameters({'datetime': datetime.now()})

```

### Read database

```python
from iflag import CorusClient
from datetime import datetime, timedelta
client = CorusClient.with_tcp_transport(address=('localhost', 4000))
client.read_database(database='interval', start=datetime.now(), stop=(datetime.now() - timedelta(hours=4)))
```

## Parameters

Not all parameters available in a device have been mapped out yet. 
But the most important ones have been.

Parameter Name  | Parameter Description
--- | ---
firmware_version | Main firmware version 
pulse_weight | Input pulse weight 
compressibility_formula | Compressibility Formula: 0=AGANX19 Standard, 1=S-GERG88, 2=PT, 3=AGANx19 Modified, 4=Not Used, 5=T, 6=16 Coeff. 7=AGA8 
pressure_base | Base pressure, in selected pressure unit 
temperature_base | Base temperature, in Kelvin 
pressure_low | Low pressure threshold (Pmin) 
pressure_high | High pressure threshold (Pmax) 
temperature_low | Low temperature threshold (Tmin) 
temperature_high | High temperature threshold (Tmax) 
datetime | Current time and date 
battery_days | Battery Autonomy Counter, in days 
index_unconverted | Unconverted Index 
index_converted | Converted Index



# Changelog
All notable changes to this project will be documented in this file.

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

## [0.1.2] - 2020-01-14

### Changed
-  Separated value identification in parsing config for the different databases so that 
it is possible to know if for example an average value is the monthly or hourly average.  

## [0.1.1] - 2020-01-08

### Fixed
- Fixed error in setup.py that listed the wrong dependency. (attr instead of attrs)

## [0.1.0] - 2020-01-08 [YANKED]

### Added
- Initial implementation of reading and writing data to Corus device.

