73 lines
2.1 KiB
ReStructuredText
Raw Normal View History

2016-08-22 18:16:11 +00:00
DSMR Parser
===========
2016-08-22 18:38:16 +00:00
.. image:: https://img.shields.io/pypi/v/dsmr-parser.svg
:target: https://pypi.python.org/pypi/dsmr-parser
2016-11-21 21:31:22 +00:00
.. image:: https://travis-ci.org/ndokter/dsmr_parser.svg?branch=master
:target: https://travis-ci.org/ndokter/dsmr_parser
2016-08-22 18:16:11 +00:00
A library for parsing Dutch Smart Meter Requirements (DSMR) telegram data. It
also includes a serial client to directly read and parse smart meter data.
Features
--------
2017-01-26 18:02:15 +00:00
DSMR Parser supports DSMR versions 2, 3, 4 and 5. It has been tested with Python 3.4 and 3.5.
2016-08-22 18:16:11 +00:00
Examples
--------
Using the serial reader to connect to your smart meter and parse it's telegrams:
.. code-block:: python
from dsmr_parser import telegram_specifications
from dsmr_parser import obis_references
from dsmr_parser.clients import SerialReader, SERIAL_SETTINGS_V4
2016-08-22 18:16:11 +00:00
serial_reader = SerialReader(
device='/dev/ttyUSB0',
serial_settings=SERIAL_SETTINGS_V4,
telegram_specification=telegram_specifications.V4
)
for telegram in serial_reader.read():
# The telegram message timestamp.
message_datetime = telegram[obis_references.P1_MESSAGE_TIMESTAMP]
2016-08-22 18:16:11 +00:00
# Using the active tariff to determine the electricity being used and
# delivered for the right tariff.
tariff = telegram[obis_references.ELECTRICITY_ACTIVE_TARIFF]
2016-08-22 18:16:11 +00:00
tariff = int(tariff.value)
electricity_used_total \
= telegram[obis_references.ELECTRICITY_USED_TARIFF_ALL[tariff - 1]]
2016-08-22 18:16:11 +00:00
electricity_delivered_total = \
telegram[obis_referencesELECTRICITY_DELIVERED_TARIFF_ALL[tariff - 1]]
2016-08-22 18:16:11 +00:00
gas_reading = telegram[obis_references.HOURLY_GAS_METER_READING]
2016-08-22 18:16:11 +00:00
# See dsmr_reader.obis_references for all readable telegram values.
Installation
------------
To install DSMR Parser:
.. code-block:: bash
$ pip install dsmr-parser
Known issues
------------
If the serial settings SERIAL_SETTINGS_V2_2 or SERIAL_SETTINGS_V4 don't work.
Make sure to try and replace the parity settings to EVEN or NONE.
It's possible that alternative settings will be added in the future if these
settings don't work for the majority of meters.