make serial.EVEN the default parity for DSMR v2.2

This commit is contained in:
Nigel Dokter 2016-11-21 21:30:56 +01:00
parent 6f3c74ce7c
commit c058feca5f
3 changed files with 21 additions and 32 deletions

View File

@ -1,13 +1,18 @@
Change Log
----------
**0.4** (2016-11-21)
- DSMR v2.2 serial settings now uses parity serial.EVEN by default (`issue #4 <https://github.com/ndokter/dsmr_parser/issues/4>`_)
- improved asyncio reader and improve it's error handling (`pull request #5 <https://github.com/ndokter/dsmr_parser/pull/5>`_)
**0.3** (2016-11-12)
- Added asyncio reader for non-blocking reads. (thanks to https://github.com/aequitas)
- asyncio reader for non-blocking reads. (`pull request #3 <https://github.com/ndokter/dsmr_parser/pull/3>`_)
**0.2** (2016-11-08)
- Added support for DMSR version 2.2 (thanks to https://github.com/aequitas)
- support for DMSR version 2.2 (`pull request #2 <https://github.com/ndokter/dsmr_parser/pull/2>`_)
**0.1** (2016-08-22)
- Initial version with a serial reader and support for DSMR version 4.x
- initial version with a serial reader and support for DSMR version 4.x

View File

@ -22,7 +22,7 @@ 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.obis_references import P1_MESSAGE_TIMESTAMP
from dsmr_parser import obis_references
from dsmr_parser.serial import SerialReader, SERIAL_SETTINGS_V4
serial_reader = SerialReader(
@ -34,25 +34,22 @@ Using the serial reader to connect to your smart meter and parse it's telegrams:
for telegram in serial_reader.read():
# The telegram message timestamp.
message_datetime = telegram[P1_MESSAGE_TIMESTAMP]
message_datetime = telegram[obis_references.P1_MESSAGE_TIMESTAMP]
# Using the active tariff to determine the electricity being used and
# delivered for the right tariff.
tariff = telegram[ELECTRICITY_ACTIVE_TARIFF]
tariff = telegram[obis_references.ELECTRICITY_ACTIVE_TARIFF]
tariff = int(tariff.value)
electricity_used_total \
= telegram[ELECTRICITY_USED_TARIFF_ALL[tariff - 1]]
= telegram[obis_references.ELECTRICITY_USED_TARIFF_ALL[tariff - 1]]
electricity_delivered_total = \
telegram[ELECTRICITY_DELIVERED_TARIFF_ALL[tariff - 1]]
telegram[obis_referencesELECTRICITY_DELIVERED_TARIFF_ALL[tariff - 1]]
gas_reading = telegram[HOURLY_GAS_METER_READING]
gas_reading = telegram[obis_references.HOURLY_GAS_METER_READING]
# See dsmr_reader.obis_references for all readable telegram values.
The dsmr_parser.serial module contains multiple settings that should work in
most cases. For example: if SERIAL_SETTINGS_V4 doesn't work, then try
SERIAL_SETTINGS_V4_EVEN too.
Installation
------------
@ -63,6 +60,13 @@ To install DSMR Parser:
$ 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.
TODO
----

View File

@ -11,16 +11,6 @@ logger = logging.getLogger(__name__)
SERIAL_SETTINGS_V2_2 = {
'baudrate': 9600,
'bytesize': serial.SEVENBITS,
'parity': serial.PARITY_NONE,
'stopbits': serial.STOPBITS_ONE,
'xonxoff': 0,
'rtscts': 0,
'timeout': 20
}
SERIAL_SETTINGS_V2_2_EVEN = {
'baudrate': 9600,
'bytesize': serial.SEVENBITS,
'parity': serial.PARITY_EVEN,
@ -31,16 +21,6 @@ SERIAL_SETTINGS_V2_2_EVEN = {
}
SERIAL_SETTINGS_V4 = {
'baudrate': 115200,
'bytesize': serial.SEVENBITS,
'parity': serial.PARITY_NONE,
'stopbits': serial.STOPBITS_ONE,
'xonxoff': 0,
'rtscts': 0,
'timeout': 20
}
SERIAL_SETTINGS_V4_EVEN = {
'baudrate': 115200,
'bytesize': serial.SEVENBITS,
'parity': serial.PARITY_EVEN,