Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a01e673646 | ||
|
|
09614860a6 | ||
|
|
3bfb555d0e | ||
|
|
3a8b4d2458 | ||
|
|
12aa003799 | ||
|
|
86690ef44b | ||
|
|
7c9c59308e | ||
|
|
b31bcd61fc | ||
|
|
50a5cb9203 | ||
|
|
8388624721 | ||
|
|
c04b0a5add | ||
|
|
ed2290a597 | ||
|
|
85c67464a1 | ||
|
|
48783acc00 | ||
|
|
41f6a7ac16 | ||
|
|
59811dbf9f | ||
|
|
9b09969763 | ||
|
|
64f5dc2e87 | ||
|
|
887dd3a2aa | ||
|
|
ad6ab304f5 | ||
|
|
8582395017 | ||
|
|
3327c78c0e | ||
|
|
472c54968e | ||
|
|
d534b1d8b0 | ||
|
|
d94bc8de03 | ||
|
|
41381f1705 | ||
|
|
e3203a5334 | ||
|
|
c78ebe3e2d | ||
|
|
d6e28db116 | ||
|
|
5f1afeb1f8 | ||
|
|
dcb59fddb1 |
@@ -1,6 +1,37 @@
|
||||
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)
|
||||
|
||||
- Changed serial reading to reduce CPU usage (`pull request #37 <https://github.com/ndokter/dsmr_parser/pull/37>`_).
|
||||
|
||||
**0.13** (2019-03-04)
|
||||
|
||||
- Fix DSMR v5.0 serial settings which were not used (`pull request #33 <https://github.com/ndokter/dsmr_parser/pull/33>`_).
|
||||
|
||||
**0.12** (2018-09-23)
|
||||
|
||||
- Add serial settings for DSMR v5.0 (`pull request #31 <https://github.com/ndokter/dsmr_parser/pull/31>`_).
|
||||
- Lux-creos-obis-1.8.0 (`pull request #32 <https://github.com/ndokter/dsmr_parser/pull/32>`_).
|
||||
|
||||
**0.11** (2017-09-18)
|
||||
|
||||
- NULL value fix in checksum (`pull request #26 <https://github.com/ndokter/dsmr_parser/pull/26>`_)
|
||||
|
||||
**0.10** (2017-06-05)
|
||||
|
||||
- bugix: don't force full telegram signatures (`pull request #25 <https://github.com/ndokter/dsmr_parser/pull/25>`_)
|
||||
- removed unused code for automatic telegram detection as this needs reworking after the fix mentioned above
|
||||
- InvalidChecksumError's are logged as warning instead of error
|
||||
|
||||
**0.9** (2017-05-12)
|
||||
|
||||
- added DSMR v5 serial settings
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from dsmr_parser.clients.settings import SERIAL_SETTINGS_V2_2, \
|
||||
SERIAL_SETTINGS_V4
|
||||
SERIAL_SETTINGS_V4, SERIAL_SETTINGS_V5
|
||||
from dsmr_parser.clients.serial_ import SerialReader, AsyncSerialReader
|
||||
from dsmr_parser.clients.protocol import create_dsmr_protocol, \
|
||||
create_dsmr_reader, create_tcp_dsmr_reader
|
||||
|
||||
@@ -8,10 +8,10 @@ from serial_asyncio import create_serial_connection
|
||||
|
||||
from dsmr_parser import telegram_specifications
|
||||
from dsmr_parser.clients.telegram_buffer import TelegramBuffer
|
||||
from dsmr_parser.exceptions import ParseError
|
||||
from dsmr_parser.exceptions import ParseError, InvalidChecksumError
|
||||
from dsmr_parser.parsers import TelegramParser
|
||||
from dsmr_parser.clients.settings import SERIAL_SETTINGS_V2_2, \
|
||||
SERIAL_SETTINGS_V4
|
||||
SERIAL_SETTINGS_V4, SERIAL_SETTINGS_V5
|
||||
|
||||
|
||||
def create_dsmr_protocol(dsmr_version, telegram_callback, loop=None):
|
||||
@@ -25,7 +25,10 @@ def create_dsmr_protocol(dsmr_version, telegram_callback, loop=None):
|
||||
serial_settings = SERIAL_SETTINGS_V4
|
||||
elif dsmr_version == '5':
|
||||
specification = telegram_specifications.V5
|
||||
serial_settings = SERIAL_SETTINGS_V4
|
||||
serial_settings = SERIAL_SETTINGS_V5
|
||||
elif dsmr_version == '5B':
|
||||
specification = telegram_specifications.BELGIUM_FLUVIUS
|
||||
serial_settings = SERIAL_SETTINGS_V5
|
||||
else:
|
||||
raise NotImplementedError("No telegram parser found for version: %s",
|
||||
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,
|
||||
telegram_callback, loop=None):
|
||||
"""Creates a DSMR asyncio protocol coroutine using TCP connection."""
|
||||
if not loop:
|
||||
loop = asyncio.get_event_loop()
|
||||
protocol, _ = create_dsmr_protocol(
|
||||
dsmr_version, telegram_callback, loop=None)
|
||||
dsmr_version, telegram_callback, loop=loop)
|
||||
conn = loop.create_connection(protocol, host, port)
|
||||
return conn
|
||||
|
||||
|
||||
class DSMRProtocol(asyncio.Protocol):
|
||||
"""Assemble and handle incoming data into complete DSM telegrams."""
|
||||
|
||||
@@ -101,6 +105,8 @@ class DSMRProtocol(asyncio.Protocol):
|
||||
|
||||
try:
|
||||
parsed_telegram = self.telegram_parser.parse(telegram)
|
||||
except InvalidChecksumError as e:
|
||||
self.log.warning(str(e))
|
||||
except ParseError:
|
||||
self.log.exception("failed to parse telegram")
|
||||
else:
|
||||
|
||||
@@ -4,7 +4,7 @@ import serial
|
||||
import serial_asyncio
|
||||
|
||||
from dsmr_parser.clients.telegram_buffer import TelegramBuffer
|
||||
from dsmr_parser.exceptions import ParseError
|
||||
from dsmr_parser.exceptions import ParseError, InvalidChecksumError
|
||||
from dsmr_parser.parsers import TelegramParser
|
||||
|
||||
|
||||
@@ -30,12 +30,14 @@ class SerialReader(object):
|
||||
"""
|
||||
with serial.Serial(**self.serial_settings) as serial_handle:
|
||||
while True:
|
||||
data = serial_handle.readline()
|
||||
data = serial_handle.read(max(1, min(1024, serial_handle.in_waiting)))
|
||||
self.telegram_buffer.append(data.decode('ascii'))
|
||||
|
||||
for telegram in self.telegram_buffer.get_all():
|
||||
try:
|
||||
yield self.telegram_parser.parse(telegram)
|
||||
except InvalidChecksumError as e:
|
||||
logger.warning(str(e))
|
||||
except ParseError as e:
|
||||
logger.error('Failed to parse telegram: %s', e)
|
||||
|
||||
|
||||
@@ -20,3 +20,13 @@ SERIAL_SETTINGS_V4 = {
|
||||
'rtscts': 0,
|
||||
'timeout': 20
|
||||
}
|
||||
|
||||
SERIAL_SETTINGS_V5 = {
|
||||
'baudrate': 115200,
|
||||
'bytesize': serial.EIGHTBITS,
|
||||
'parity': serial.PARITY_NONE,
|
||||
'stopbits': serial.STOPBITS_ONE,
|
||||
'xonxoff': 0,
|
||||
'rtscts': 0,
|
||||
'timeout': 20
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class TelegramBuffer(object):
|
||||
# - The checksum is optional '{0,4}' because not all telegram versions
|
||||
# support it.
|
||||
return re.findall(
|
||||
r'\/[^\/]+?\![A-F0-9]{0,4}\r\n',
|
||||
r'\/[^\/]+?\![A-F0-9]{0,4}\0?\r\n',
|
||||
self._buffer,
|
||||
re.DOTALL
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ objects are introduced.
|
||||
"""
|
||||
P1_MESSAGE_HEADER = r'\d-\d:0\.2\.8.+?\r\n'
|
||||
P1_MESSAGE_TIMESTAMP = r'\d-\d:1\.0\.0.+?\r\n'
|
||||
ELECTRICITY_IMPORTED_TOTAL = r'\d-\d:1\.8\.0.+?\r\n'
|
||||
ELECTRICITY_USED_TARIFF_1 = r'\d-\d:1\.8\.1.+?\r\n'
|
||||
ELECTRICITY_USED_TARIFF_2 = r'\d-\d:1\.8\.2.+?\r\n'
|
||||
ELECTRICITY_DELIVERED_TARIFF_1 = r'\d-\d:2\.8\.1.+?\r\n'
|
||||
@@ -17,6 +18,7 @@ EQUIPMENT_IDENTIFIER = r'\d-\d:96\.1\.1.+?\r\n'
|
||||
CURRENT_ELECTRICITY_USAGE = r'\d-\d:1\.7\.0.+?\r\n'
|
||||
CURRENT_ELECTRICITY_DELIVERY = r'\d-\d:2\.7\.0.+?\r\n'
|
||||
LONG_POWER_FAILURE_COUNT = r'96\.7\.9.+?\r\n'
|
||||
SHORT_POWER_FAILURE_COUNT = r'96\.7\.21.+?\r\n'
|
||||
POWER_EVENT_FAILURE_LOG = r'99\.97\.0.+?\r\n'
|
||||
VOLTAGE_SAG_L1_COUNT = r'\d-\d:32\.32\.0.+?\r\n'
|
||||
VOLTAGE_SAG_L2_COUNT = r'\d-\d:52\.32\.0.+?\r\n'
|
||||
@@ -24,6 +26,12 @@ VOLTAGE_SAG_L3_COUNT = r'\d-\d:72\.32\.0.+?\r\n'
|
||||
VOLTAGE_SWELL_L1_COUNT = r'\d-\d:32\.36\.0.+?\r\n'
|
||||
VOLTAGE_SWELL_L2_COUNT = r'\d-\d:52\.36\.0.+?\r\n'
|
||||
VOLTAGE_SWELL_L3_COUNT = r'\d-\d:72\.36\.0.+?\r\n'
|
||||
INSTANTANEOUS_VOLTAGE_L1 = r'\d-\d:32\.7\.0.+?\r\n'
|
||||
INSTANTANEOUS_VOLTAGE_L2 = r'\d-\d:52\.7\.0.+?\r\n'
|
||||
INSTANTANEOUS_VOLTAGE_L3 = r'\d-\d:72\.7\.0.+?\r\n'
|
||||
INSTANTANEOUS_CURRENT_L1 = r'\d-\d:31\.7\.0.+?\r\n'
|
||||
INSTANTANEOUS_CURRENT_L2 = r'\d-\d:51\.7\.0.+?\r\n'
|
||||
INSTANTANEOUS_CURRENT_L3 = r'\d-\d:71\.7\.0.+?\r\n'
|
||||
TEXT_MESSAGE_CODE = r'\d-\d:96\.13\.1.+?\r\n'
|
||||
TEXT_MESSAGE = r'\d-\d:96\.13\.0.+?\r\n'
|
||||
DEVICE_TYPE = r'\d-\d:24\.1\.0.+?\r\n'
|
||||
@@ -52,3 +60,8 @@ ELECTRICITY_DELIVERED_TARIFF_ALL = (
|
||||
ELECTRICITY_DELIVERED_TARIFF_1,
|
||||
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-)
|
||||
|
||||
+8
-34
@@ -51,12 +51,10 @@ class TelegramParser(object):
|
||||
for signature, parser in self.telegram_specification['objects'].items():
|
||||
match = re.search(signature, telegram_data, re.DOTALL)
|
||||
|
||||
# All telegram specification lines/signatures are expected to be
|
||||
# present.
|
||||
if not match:
|
||||
raise ParseError('Telegram specification does not match '
|
||||
'telegram data')
|
||||
telegram[signature] = parser.parse(match.group(0))
|
||||
# Some signatures are optional and may not be present,
|
||||
# so only parse lines that match
|
||||
if match:
|
||||
telegram[signature] = parser.parse(match.group(0))
|
||||
|
||||
return telegram
|
||||
|
||||
@@ -94,31 +92,6 @@ class TelegramParser(object):
|
||||
)
|
||||
|
||||
|
||||
def match_telegram_specification(telegram_data):
|
||||
"""
|
||||
Find telegram specification that matches the telegram data by trying all
|
||||
specifications.
|
||||
|
||||
Could be further optimized to check the actual 0.2.8 OBIS reference which
|
||||
is available for DSMR version 4 and up.
|
||||
|
||||
:param str telegram_data: full telegram from start ('/') to checksum
|
||||
('!ABCD') including line endings in between the telegram's lines
|
||||
:return: telegram specification
|
||||
:rtype: dict
|
||||
"""
|
||||
# Prevent circular import
|
||||
from dsmr_parser import telegram_specifications
|
||||
|
||||
for specification in telegram_specifications.ALL:
|
||||
try:
|
||||
TelegramParser(specification).parse(telegram_data)
|
||||
except ParseError:
|
||||
pass
|
||||
else:
|
||||
return specification
|
||||
|
||||
|
||||
class DSMRObjectParser(object):
|
||||
"""
|
||||
Parses an object (can also be see as a 'line') from a telegram.
|
||||
@@ -176,10 +149,11 @@ class CosemParser(DSMRObjectParser):
|
||||
1 23 45
|
||||
|
||||
1) OBIS Reduced ID-code
|
||||
2) Separator “(“, ASCII 28h
|
||||
2) Separator "(", ASCII 28h
|
||||
3) COSEM object attribute value
|
||||
4) Unit of measurement values (Unit of capture objects attribute) – only if applicable
|
||||
5) Separator “)”, ASCII 29h
|
||||
4) Unit of measurement values (Unit of capture objects attribute) - only if
|
||||
applicable
|
||||
5) Separator ")", ASCII 29h
|
||||
"""
|
||||
|
||||
def parse(self, line):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from decimal import Decimal
|
||||
from copy import deepcopy
|
||||
|
||||
from dsmr_parser import obis_references as obis
|
||||
from dsmr_parser.parsers import CosemParser, ValueParser, MBusParser
|
||||
@@ -88,6 +89,7 @@ V5 = {
|
||||
obis.P1_MESSAGE_HEADER: CosemParser(ValueParser(str)),
|
||||
obis.P1_MESSAGE_TIMESTAMP: CosemParser(ValueParser(timestamp)),
|
||||
obis.EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
||||
obis.ELECTRICITY_IMPORTED_TOTAL: CosemParser(ValueParser(Decimal)),
|
||||
obis.ELECTRICITY_USED_TARIFF_1: CosemParser(ValueParser(Decimal)),
|
||||
obis.ELECTRICITY_USED_TARIFF_2: CosemParser(ValueParser(Decimal)),
|
||||
obis.ELECTRICITY_DELIVERED_TARIFF_1: CosemParser(ValueParser(Decimal)),
|
||||
@@ -96,6 +98,7 @@ V5 = {
|
||||
obis.CURRENT_ELECTRICITY_USAGE: CosemParser(ValueParser(Decimal)),
|
||||
obis.CURRENT_ELECTRICITY_DELIVERY: CosemParser(ValueParser(Decimal)),
|
||||
obis.LONG_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
||||
obis.SHORT_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
||||
# POWER_EVENT_FAILURE_LOG: ProfileGenericParser(), TODO
|
||||
obis.VOLTAGE_SAG_L1_COUNT: CosemParser(ValueParser(int)),
|
||||
obis.VOLTAGE_SAG_L2_COUNT: CosemParser(ValueParser(int)),
|
||||
@@ -103,6 +106,12 @@ V5 = {
|
||||
obis.VOLTAGE_SWELL_L1_COUNT: CosemParser(ValueParser(int)),
|
||||
obis.VOLTAGE_SWELL_L2_COUNT: CosemParser(ValueParser(int)),
|
||||
obis.VOLTAGE_SWELL_L3_COUNT: CosemParser(ValueParser(int)),
|
||||
obis.INSTANTANEOUS_VOLTAGE_L1: CosemParser(ValueParser(Decimal)),
|
||||
obis.INSTANTANEOUS_VOLTAGE_L2: CosemParser(ValueParser(Decimal)),
|
||||
obis.INSTANTANEOUS_VOLTAGE_L3: CosemParser(ValueParser(Decimal)),
|
||||
obis.INSTANTANEOUS_CURRENT_L1: CosemParser(ValueParser(Decimal)),
|
||||
obis.INSTANTANEOUS_CURRENT_L2: CosemParser(ValueParser(Decimal)),
|
||||
obis.INSTANTANEOUS_CURRENT_L3: CosemParser(ValueParser(Decimal)),
|
||||
obis.TEXT_MESSAGE: CosemParser(ValueParser(str)),
|
||||
obis.DEVICE_TYPE: CosemParser(ValueParser(int)),
|
||||
obis.INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE: CosemParser(ValueParser(Decimal)),
|
||||
@@ -120,3 +129,18 @@ 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)),
|
||||
})
|
||||
|
||||
@@ -4,9 +4,9 @@ setup(
|
||||
name='dsmr-parser',
|
||||
description='Library to parse Dutch Smart Meter Requirements (DSMR)',
|
||||
author='Nigel Dokter',
|
||||
author_email='nigeldokter@gmail.com',
|
||||
author_email='nigel@nldr.net',
|
||||
url='https://github.com/ndokter/dsmr_parser',
|
||||
version='0.9',
|
||||
version='0.16',
|
||||
packages=find_packages(),
|
||||
install_requires=[
|
||||
'pyserial>=3,<4',
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import unittest
|
||||
|
||||
from dsmr_parser.parsers import match_telegram_specification
|
||||
from dsmr_parser import telegram_specifications
|
||||
from test import example_telegrams
|
||||
|
||||
|
||||
class MatchTelegramSpecificationTest(unittest.TestCase):
|
||||
|
||||
def test_v2_2(self):
|
||||
assert match_telegram_specification(example_telegrams.TELEGRAM_V2_2) \
|
||||
== telegram_specifications.V2_2
|
||||
|
||||
def test_v3(self):
|
||||
assert match_telegram_specification(example_telegrams.TELEGRAM_V3) \
|
||||
== telegram_specifications.V3
|
||||
|
||||
def test_v4_2(self):
|
||||
assert match_telegram_specification(example_telegrams.TELEGRAM_V4_2) \
|
||||
== telegram_specifications.V4
|
||||
|
||||
def test_v5(self):
|
||||
assert match_telegram_specification(example_telegrams.TELEGRAM_V5) \
|
||||
== telegram_specifications.V5
|
||||
@@ -87,6 +87,12 @@ class TelegramParserV5Test(unittest.TestCase):
|
||||
assert isinstance(result[obis.LONG_POWER_FAILURE_COUNT].value, int)
|
||||
assert result[obis.LONG_POWER_FAILURE_COUNT].value == 0
|
||||
|
||||
# SHORT_POWER_FAILURE_COUNT (1-0:96.7.21)
|
||||
assert isinstance(result[obis.SHORT_POWER_FAILURE_COUNT], CosemObject)
|
||||
assert result[obis.SHORT_POWER_FAILURE_COUNT].unit is None
|
||||
assert isinstance(result[obis.SHORT_POWER_FAILURE_COUNT].value, int)
|
||||
assert result[obis.SHORT_POWER_FAILURE_COUNT].value == 13
|
||||
|
||||
# VOLTAGE_SAG_L1_COUNT (1-0:32.32.0)
|
||||
assert isinstance(result[obis.VOLTAGE_SAG_L1_COUNT], CosemObject)
|
||||
assert result[obis.VOLTAGE_SAG_L1_COUNT].unit is None
|
||||
@@ -123,6 +129,42 @@ class TelegramParserV5Test(unittest.TestCase):
|
||||
assert isinstance(result[obis.VOLTAGE_SWELL_L3_COUNT].value, int)
|
||||
assert result[obis.VOLTAGE_SWELL_L3_COUNT].value == 0
|
||||
|
||||
# INSTANTANEOUS_VOLTAGE_L1 (1-0:32.7.0)
|
||||
assert isinstance(result[obis.INSTANTANEOUS_VOLTAGE_L1], CosemObject)
|
||||
assert result[obis.INSTANTANEOUS_VOLTAGE_L1].unit == 'V'
|
||||
assert isinstance(result[obis.INSTANTANEOUS_VOLTAGE_L1].value, Decimal)
|
||||
assert result[obis.INSTANTANEOUS_VOLTAGE_L1].value == Decimal('230.0')
|
||||
|
||||
# INSTANTANEOUS_VOLTAGE_L2 (1-0:52.7.0)
|
||||
assert isinstance(result[obis.INSTANTANEOUS_VOLTAGE_L2], CosemObject)
|
||||
assert result[obis.INSTANTANEOUS_VOLTAGE_L2].unit == 'V'
|
||||
assert isinstance(result[obis.INSTANTANEOUS_VOLTAGE_L2].value, Decimal)
|
||||
assert result[obis.INSTANTANEOUS_VOLTAGE_L2].value == Decimal('230.0')
|
||||
|
||||
# INSTANTANEOUS_VOLTAGE_L3 (1-0:72.7.0)
|
||||
assert isinstance(result[obis.INSTANTANEOUS_VOLTAGE_L3], CosemObject)
|
||||
assert result[obis.INSTANTANEOUS_VOLTAGE_L3].unit == 'V'
|
||||
assert isinstance(result[obis.INSTANTANEOUS_VOLTAGE_L3].value, Decimal)
|
||||
assert result[obis.INSTANTANEOUS_VOLTAGE_L3].value == Decimal('229.0')
|
||||
|
||||
# INSTANTANEOUS_CURRENT_L1 (1-0:31.7.0)
|
||||
assert isinstance(result[obis.INSTANTANEOUS_CURRENT_L1], CosemObject)
|
||||
assert result[obis.INSTANTANEOUS_CURRENT_L1].unit == 'A'
|
||||
assert isinstance(result[obis.INSTANTANEOUS_CURRENT_L1].value, Decimal)
|
||||
assert result[obis.INSTANTANEOUS_CURRENT_L1].value == Decimal('0.48')
|
||||
|
||||
# INSTANTANEOUS_CURRENT_L2 (1-0:51.7.0)
|
||||
assert isinstance(result[obis.INSTANTANEOUS_CURRENT_L2], CosemObject)
|
||||
assert result[obis.INSTANTANEOUS_CURRENT_L2].unit == 'A'
|
||||
assert isinstance(result[obis.INSTANTANEOUS_CURRENT_L2].value, Decimal)
|
||||
assert result[obis.INSTANTANEOUS_CURRENT_L2].value == Decimal('0.44')
|
||||
|
||||
# INSTANTANEOUS_CURRENT_L3 (1-0:71.7.0)
|
||||
assert isinstance(result[obis.INSTANTANEOUS_CURRENT_L3], CosemObject)
|
||||
assert result[obis.INSTANTANEOUS_CURRENT_L3].unit == 'A'
|
||||
assert isinstance(result[obis.INSTANTANEOUS_CURRENT_L3].value, Decimal)
|
||||
assert result[obis.INSTANTANEOUS_CURRENT_L3].value == Decimal('0.86')
|
||||
|
||||
# TEXT_MESSAGE (0-0:96.13.0)
|
||||
assert isinstance(result[obis.TEXT_MESSAGE], CosemObject)
|
||||
assert result[obis.TEXT_MESSAGE].unit is None
|
||||
|
||||
Reference in New Issue
Block a user