Merge branch 'master' into add_a_true_telegram_object
This commit is contained in:
commit
74fe1f2d1e
@ -1,6 +1,14 @@
|
|||||||
Change Log
|
Change Log
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
**0.16** (2019-12-21)
|
||||||
|
|
||||||
|
- Add support for Belgian and Smarty meters (`pull request #44 <https://github.com/ndokter/dsmr_parser/pull/44>`_).
|
||||||
|
|
||||||
|
**0.15** (2019-12-12)
|
||||||
|
|
||||||
|
- Fixed asyncio loop issue (`pull request #43 <https://github.com/ndokter/dsmr_parser/pull/43>`_).
|
||||||
|
|
||||||
**0.14** (2019-10-08)
|
**0.14** (2019-10-08)
|
||||||
|
|
||||||
- Changed serial reading to reduce CPU usage (`pull request #37 <https://github.com/ndokter/dsmr_parser/pull/37>`_).
|
- Changed serial reading to reduce CPU usage (`pull request #37 <https://github.com/ndokter/dsmr_parser/pull/37>`_).
|
||||||
|
@ -26,6 +26,9 @@ def create_dsmr_protocol(dsmr_version, telegram_callback, loop=None):
|
|||||||
elif dsmr_version == '5':
|
elif dsmr_version == '5':
|
||||||
specification = telegram_specifications.V5
|
specification = telegram_specifications.V5
|
||||||
serial_settings = SERIAL_SETTINGS_V5
|
serial_settings = SERIAL_SETTINGS_V5
|
||||||
|
elif dsmr_version == '5B':
|
||||||
|
specification = telegram_specifications.BELGIUM_FLUVIUS
|
||||||
|
serial_settings = SERIAL_SETTINGS_V5
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("No telegram parser found for version: %s",
|
raise NotImplementedError("No telegram parser found for version: %s",
|
||||||
dsmr_version)
|
dsmr_version)
|
||||||
@ -49,12 +52,13 @@ def create_dsmr_reader(port, dsmr_version, telegram_callback, loop=None):
|
|||||||
def create_tcp_dsmr_reader(host, port, dsmr_version,
|
def create_tcp_dsmr_reader(host, port, dsmr_version,
|
||||||
telegram_callback, loop=None):
|
telegram_callback, loop=None):
|
||||||
"""Creates a DSMR asyncio protocol coroutine using TCP connection."""
|
"""Creates a DSMR asyncio protocol coroutine using TCP connection."""
|
||||||
|
if not loop:
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
protocol, _ = create_dsmr_protocol(
|
protocol, _ = create_dsmr_protocol(
|
||||||
dsmr_version, telegram_callback, loop=None)
|
dsmr_version, telegram_callback, loop=loop)
|
||||||
conn = loop.create_connection(protocol, host, port)
|
conn = loop.create_connection(protocol, host, port)
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
|
||||||
class DSMRProtocol(asyncio.Protocol):
|
class DSMRProtocol(asyncio.Protocol):
|
||||||
"""Assemble and handle incoming data into complete DSM telegrams."""
|
"""Assemble and handle incoming data into complete DSM telegrams."""
|
||||||
|
|
||||||
|
@ -60,3 +60,8 @@ ELECTRICITY_DELIVERED_TARIFF_ALL = (
|
|||||||
ELECTRICITY_DELIVERED_TARIFF_1,
|
ELECTRICITY_DELIVERED_TARIFF_1,
|
||||||
ELECTRICITY_DELIVERED_TARIFF_2
|
ELECTRICITY_DELIVERED_TARIFF_2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Alternate codes for foreign countries.
|
||||||
|
BELGIUM_HOURLY_GAS_METER_READING = r'\d-\d:24\.2\.3.+?\r\n' # Different code, same format.
|
||||||
|
LUXEMBOURG_ELECTRICITY_USED_TARIFF_GLOBAL = r'\d-\d:1\.8\.0.+?\r\n' # Total imported energy register (P+)
|
||||||
|
LUXEMBOURG_ELECTRICITY_DELIVERED_TARIFF_GLOBAL = r'\d-\d:2\.8\.0.+?\r\n' # Total exported energy register (P-)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
from dsmr_parser import obis_references as obis
|
from dsmr_parser import obis_references as obis
|
||||||
from dsmr_parser.parsers import CosemParser, ValueParser, MBusParser
|
from dsmr_parser.parsers import CosemParser, ValueParser, MBusParser
|
||||||
@ -128,3 +129,18 @@ V5 = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ALL = (V2_2, V3, V4, V5)
|
ALL = (V2_2, V3, V4, V5)
|
||||||
|
|
||||||
|
|
||||||
|
BELGIUM_FLUVIUS = deepcopy(V5)
|
||||||
|
BELGIUM_FLUVIUS['objects'].update({
|
||||||
|
obis.BELGIUM_HOURLY_GAS_METER_READING: MBusParser(
|
||||||
|
ValueParser(timestamp),
|
||||||
|
ValueParser(Decimal)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
LUXEMBOURG_SMARTY = deepcopy(V5)
|
||||||
|
LUXEMBOURG_SMARTY['objects'].update({
|
||||||
|
obis.LUXEMBOURG_ELECTRICITY_USED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
||||||
|
obis.LUXEMBOURG_ELECTRICITY_DELIVERED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
||||||
|
})
|
||||||
|
2
setup.py
2
setup.py
@ -6,7 +6,7 @@ setup(
|
|||||||
author='Nigel Dokter',
|
author='Nigel Dokter',
|
||||||
author_email='nigel@nldr.net',
|
author_email='nigel@nldr.net',
|
||||||
url='https://github.com/ndokter/dsmr_parser',
|
url='https://github.com/ndokter/dsmr_parser',
|
||||||
version='0.15',
|
version='0.17',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'pyserial>=3,<4',
|
'pyserial>=3,<4',
|
||||||
|
Loading…
Reference in New Issue
Block a user