clean-up re-format
This commit is contained in:
parent
17b56ae07b
commit
2b724b87c3
@ -2,30 +2,20 @@ from decimal import Decimal
|
|||||||
from copy import deepcopy
|
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 (
|
from dsmr_parser.parsers import CosemParser, ValueParser, MBusParser, ProfileGenericParser
|
||||||
CosemParser,
|
|
||||||
ValueParser,
|
|
||||||
MBusParser,
|
|
||||||
ProfileGenericParser,
|
|
||||||
)
|
|
||||||
from dsmr_parser.value_types import timestamp
|
from dsmr_parser.value_types import timestamp
|
||||||
from dsmr_parser.profile_generic_specifications import (
|
from dsmr_parser.profile_generic_specifications import BUFFER_TYPES, PG_HEAD_PARSERS, PG_UNIDENTIFIED_BUFFERTYPE_PARSERS
|
||||||
BUFFER_TYPES,
|
|
||||||
PG_HEAD_PARSERS,
|
|
||||||
PG_UNIDENTIFIED_BUFFERTYPE_PARSERS,
|
|
||||||
)
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
dsmr_parser.telegram_specifications
|
dsmr_parser.telegram_specifications
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
This module contains DSMR telegram specifications. Each specifications describes
|
This module contains DSMR telegram specifications. Each specifications describes
|
||||||
how the telegram lines are parsed.
|
how the telegram lines are parsed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
V2_2 = {
|
V2_2 = {
|
||||||
"checksum_support": False,
|
'checksum_support': False,
|
||||||
"objects": {
|
'objects': {
|
||||||
obis.EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
obis.EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
||||||
obis.ELECTRICITY_USED_TARIFF_1: CosemParser(ValueParser(Decimal)),
|
obis.ELECTRICITY_USED_TARIFF_1: CosemParser(ValueParser(Decimal)),
|
||||||
obis.ELECTRICITY_USED_TARIFF_2: CosemParser(ValueParser(Decimal)),
|
obis.ELECTRICITY_USED_TARIFF_2: CosemParser(ValueParser(Decimal)),
|
||||||
@ -50,14 +40,14 @@ V2_2 = {
|
|||||||
ValueParser(str), # unit, position 5
|
ValueParser(str), # unit, position 5
|
||||||
ValueParser(Decimal), # meter reading, position 6
|
ValueParser(Decimal), # meter reading, position 6
|
||||||
),
|
),
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
V3 = V2_2
|
V3 = V2_2
|
||||||
|
|
||||||
V4 = {
|
V4 = {
|
||||||
"checksum_support": True,
|
'checksum_support': True,
|
||||||
"objects": {
|
'objects': {
|
||||||
obis.P1_MESSAGE_HEADER: CosemParser(ValueParser(str)),
|
obis.P1_MESSAGE_HEADER: CosemParser(ValueParser(str)),
|
||||||
obis.P1_MESSAGE_TIMESTAMP: CosemParser(ValueParser(timestamp)),
|
obis.P1_MESSAGE_TIMESTAMP: CosemParser(ValueParser(timestamp)),
|
||||||
obis.EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
obis.EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
||||||
@ -70,9 +60,10 @@ V4 = {
|
|||||||
obis.CURRENT_ELECTRICITY_DELIVERY: CosemParser(ValueParser(Decimal)),
|
obis.CURRENT_ELECTRICITY_DELIVERY: CosemParser(ValueParser(Decimal)),
|
||||||
obis.SHORT_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
obis.SHORT_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
||||||
obis.LONG_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
obis.LONG_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
||||||
obis.POWER_EVENT_FAILURE_LOG: ProfileGenericParser(
|
obis.POWER_EVENT_FAILURE_LOG:
|
||||||
BUFFER_TYPES, PG_HEAD_PARSERS, PG_UNIDENTIFIED_BUFFERTYPE_PARSERS
|
ProfileGenericParser(BUFFER_TYPES,
|
||||||
),
|
PG_HEAD_PARSERS,
|
||||||
|
PG_UNIDENTIFIED_BUFFERTYPE_PARSERS),
|
||||||
obis.VOLTAGE_SAG_L1_COUNT: CosemParser(ValueParser(int)),
|
obis.VOLTAGE_SAG_L1_COUNT: CosemParser(ValueParser(int)),
|
||||||
obis.VOLTAGE_SAG_L2_COUNT: CosemParser(ValueParser(int)),
|
obis.VOLTAGE_SAG_L2_COUNT: CosemParser(ValueParser(int)),
|
||||||
obis.VOLTAGE_SAG_L3_COUNT: CosemParser(ValueParser(int)),
|
obis.VOLTAGE_SAG_L3_COUNT: CosemParser(ValueParser(int)),
|
||||||
@ -93,14 +84,15 @@ V4 = {
|
|||||||
obis.INSTANTANEOUS_ACTIVE_POWER_L3_NEGATIVE: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_ACTIVE_POWER_L3_NEGATIVE: CosemParser(ValueParser(Decimal)),
|
||||||
obis.EQUIPMENT_IDENTIFIER_GAS: CosemParser(ValueParser(str)),
|
obis.EQUIPMENT_IDENTIFIER_GAS: CosemParser(ValueParser(str)),
|
||||||
obis.HOURLY_GAS_METER_READING: MBusParser(
|
obis.HOURLY_GAS_METER_READING: MBusParser(
|
||||||
ValueParser(timestamp), ValueParser(Decimal)
|
ValueParser(timestamp),
|
||||||
),
|
ValueParser(Decimal)
|
||||||
},
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
V5 = {
|
V5 = {
|
||||||
"checksum_support": True,
|
'checksum_support': True,
|
||||||
"objects": {
|
'objects': {
|
||||||
obis.P1_MESSAGE_HEADER: CosemParser(ValueParser(str)),
|
obis.P1_MESSAGE_HEADER: CosemParser(ValueParser(str)),
|
||||||
obis.P1_MESSAGE_TIMESTAMP: CosemParser(ValueParser(timestamp)),
|
obis.P1_MESSAGE_TIMESTAMP: CosemParser(ValueParser(timestamp)),
|
||||||
obis.EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
obis.EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
||||||
@ -114,9 +106,10 @@ V5 = {
|
|||||||
obis.CURRENT_ELECTRICITY_DELIVERY: CosemParser(ValueParser(Decimal)),
|
obis.CURRENT_ELECTRICITY_DELIVERY: CosemParser(ValueParser(Decimal)),
|
||||||
obis.LONG_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
obis.LONG_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
||||||
obis.SHORT_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
obis.SHORT_POWER_FAILURE_COUNT: CosemParser(ValueParser(int)),
|
||||||
obis.POWER_EVENT_FAILURE_LOG: ProfileGenericParser(
|
obis.POWER_EVENT_FAILURE_LOG:
|
||||||
BUFFER_TYPES, PG_HEAD_PARSERS, PG_UNIDENTIFIED_BUFFERTYPE_PARSERS
|
ProfileGenericParser(BUFFER_TYPES,
|
||||||
),
|
PG_HEAD_PARSERS,
|
||||||
|
PG_UNIDENTIFIED_BUFFERTYPE_PARSERS),
|
||||||
obis.VOLTAGE_SAG_L1_COUNT: CosemParser(ValueParser(int)),
|
obis.VOLTAGE_SAG_L1_COUNT: CosemParser(ValueParser(int)),
|
||||||
obis.VOLTAGE_SAG_L2_COUNT: CosemParser(ValueParser(int)),
|
obis.VOLTAGE_SAG_L2_COUNT: CosemParser(ValueParser(int)),
|
||||||
obis.VOLTAGE_SAG_L3_COUNT: CosemParser(ValueParser(int)),
|
obis.VOLTAGE_SAG_L3_COUNT: CosemParser(ValueParser(int)),
|
||||||
@ -139,46 +132,38 @@ V5 = {
|
|||||||
obis.INSTANTANEOUS_ACTIVE_POWER_L3_NEGATIVE: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_ACTIVE_POWER_L3_NEGATIVE: CosemParser(ValueParser(Decimal)),
|
||||||
obis.EQUIPMENT_IDENTIFIER_GAS: CosemParser(ValueParser(str)),
|
obis.EQUIPMENT_IDENTIFIER_GAS: CosemParser(ValueParser(str)),
|
||||||
obis.HOURLY_GAS_METER_READING: MBusParser(
|
obis.HOURLY_GAS_METER_READING: MBusParser(
|
||||||
ValueParser(timestamp), ValueParser(Decimal)
|
ValueParser(timestamp),
|
||||||
),
|
ValueParser(Decimal)
|
||||||
},
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ALL = (V2_2, V3, V4, V5)
|
ALL = (V2_2, V3, V4, V5)
|
||||||
|
|
||||||
|
|
||||||
BELGIUM_FLUVIUS = deepcopy(V5)
|
BELGIUM_FLUVIUS = deepcopy(V5)
|
||||||
BELGIUM_FLUVIUS["objects"].update(
|
BELGIUM_FLUVIUS['objects'].update({
|
||||||
{
|
|
||||||
obis.BELGIUM_HOURLY_GAS_METER_READING: MBusParser(
|
obis.BELGIUM_HOURLY_GAS_METER_READING: MBusParser(
|
||||||
ValueParser(timestamp), ValueParser(Decimal)
|
ValueParser(timestamp),
|
||||||
)
|
ValueParser(Decimal)
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
})
|
||||||
|
|
||||||
LUXEMBOURG_SMARTY = deepcopy(V5)
|
LUXEMBOURG_SMARTY = deepcopy(V5)
|
||||||
LUXEMBOURG_SMARTY["objects"].update(
|
LUXEMBOURG_SMARTY['objects'].update({
|
||||||
{
|
|
||||||
obis.LUXEMBOURG_EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
obis.LUXEMBOURG_EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
||||||
obis.LUXEMBOURG_ELECTRICITY_USED_TARIFF_GLOBAL: CosemParser(
|
obis.LUXEMBOURG_ELECTRICITY_USED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
||||||
ValueParser(Decimal)
|
obis.LUXEMBOURG_ELECTRICITY_DELIVERED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
||||||
),
|
})
|
||||||
obis.LUXEMBOURG_ELECTRICITY_DELIVERED_TARIFF_GLOBAL: CosemParser(
|
|
||||||
ValueParser(Decimal)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source: https://www.energiforetagen.se/globalassets/energiforetagen/det-erbjuder-vi/kurser-och-konferenser/elnat/branschrekommendation-lokalt-granssnitt-v2_0-201912.pdf
|
# Source: https://www.energiforetagen.se/globalassets/energiforetagen/det-erbjuder-vi/kurser-och-konferenser/elnat/branschrekommendation-lokalt-granssnitt-v2_0-201912.pdf
|
||||||
SWEDEN = {
|
SWEDEN = {
|
||||||
"checksum_support": True,
|
'checksum_support': True,
|
||||||
"objects": {
|
'objects': {
|
||||||
obis.P1_MESSAGE_HEADER: CosemParser(ValueParser(str)),
|
obis.P1_MESSAGE_HEADER: CosemParser(ValueParser(str)),
|
||||||
obis.P1_MESSAGE_TIMESTAMP: CosemParser(ValueParser(timestamp)),
|
obis.P1_MESSAGE_TIMESTAMP: CosemParser(ValueParser(timestamp)),
|
||||||
obis.SWEDEN_ELECTRICITY_USED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
obis.SWEDEN_ELECTRICITY_USED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
||||||
obis.SWEDEN_ELECTRICITY_DELIVERED_TARIFF_GLOBAL: CosemParser(
|
obis.SWEDEN_ELECTRICITY_DELIVERED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
||||||
ValueParser(Decimal)
|
|
||||||
),
|
|
||||||
obis.CURRENT_ELECTRICITY_USAGE: CosemParser(ValueParser(Decimal)),
|
obis.CURRENT_ELECTRICITY_USAGE: CosemParser(ValueParser(Decimal)),
|
||||||
obis.CURRENT_ELECTRICITY_DELIVERY: CosemParser(ValueParser(Decimal)),
|
obis.CURRENT_ELECTRICITY_DELIVERY: CosemParser(ValueParser(Decimal)),
|
||||||
obis.INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE: CosemParser(ValueParser(Decimal)),
|
||||||
@ -193,19 +178,16 @@ SWEDEN = {
|
|||||||
obis.INSTANTANEOUS_CURRENT_L1: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_CURRENT_L1: CosemParser(ValueParser(Decimal)),
|
||||||
obis.INSTANTANEOUS_CURRENT_L2: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_CURRENT_L2: CosemParser(ValueParser(Decimal)),
|
||||||
obis.INSTANTANEOUS_CURRENT_L3: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_CURRENT_L3: CosemParser(ValueParser(Decimal)),
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Q3D = {
|
Q3D = {
|
||||||
"checksum_support": False,
|
"checksum_support": False,
|
||||||
"objects": {
|
"objects": {
|
||||||
obis.Q3D_EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
obis.Q3D_EQUIPMENT_IDENTIFIER: CosemParser(ValueParser(str)),
|
||||||
obis.LUXEMBOURG_ELECTRICITY_USED_TARIFF_GLOBAL: CosemParser(
|
obis.LUXEMBOURG_ELECTRICITY_USED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
||||||
ValueParser(Decimal)
|
obis.LUXEMBOURG_ELECTRICITY_DELIVERED_TARIFF_GLOBAL: CosemParser(ValueParser(Decimal)),
|
||||||
),
|
|
||||||
obis.LUXEMBOURG_ELECTRICITY_DELIVERED_TARIFF_GLOBAL: CosemParser(
|
|
||||||
ValueParser(Decimal)
|
|
||||||
),
|
|
||||||
obis.INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE: CosemParser(ValueParser(Decimal)),
|
||||||
obis.INSTANTANEOUS_ACTIVE_POWER_L2_POSITIVE: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_ACTIVE_POWER_L2_POSITIVE: CosemParser(ValueParser(Decimal)),
|
||||||
obis.INSTANTANEOUS_ACTIVE_POWER_L3_POSITIVE: CosemParser(ValueParser(Decimal)),
|
obis.INSTANTANEOUS_ACTIVE_POWER_L3_POSITIVE: CosemParser(ValueParser(Decimal)),
|
||||||
|
Loading…
Reference in New Issue
Block a user