Refactor of name mapping, added E.ON Hungary (#137)
* Added EON HUNGARY specification * refactoring obis name mapping
This commit is contained in:
@@ -12,19 +12,31 @@ class MbusDeviceTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
v5_objects = telegram_specifications.V5['objects']
|
||||
|
||||
device_type_parser = v5_objects[obis_references.DEVICE_TYPE]
|
||||
device_type_parser = [
|
||||
object["value_parser"]
|
||||
for object in v5_objects
|
||||
if object["obis_reference"] == obis_references.DEVICE_TYPE
|
||||
][0]
|
||||
device_type = device_type_parser.parse('0-2:24.1.0(003)\r\n')
|
||||
|
||||
equipment_parser = v5_objects[obis_references.EQUIPMENT_IDENTIFIER_GAS]
|
||||
equipment_parser = [
|
||||
object["value_parser"]
|
||||
for object in v5_objects
|
||||
if object["obis_reference"] == obis_references.EQUIPMENT_IDENTIFIER_GAS
|
||||
][0]
|
||||
equipment = equipment_parser.parse('0-2:96.1.0(4730303339303031393336393930363139)\r\n')
|
||||
|
||||
gas_reading_parser = v5_objects[obis_references.HOURLY_GAS_METER_READING]
|
||||
gas_reading_parser = [
|
||||
object["value_parser"]
|
||||
for object in v5_objects
|
||||
if object["obis_reference"] == obis_references.HOURLY_GAS_METER_READING
|
||||
][0]
|
||||
gas_reading = gas_reading_parser.parse('0-2:24.2.1(200426223001S)(00246.138*m3)\r\n')
|
||||
|
||||
mbus_device = MbusDevice(channel_id=1)
|
||||
mbus_device.add(obis_references.DEVICE_TYPE, device_type)
|
||||
mbus_device.add(obis_references.EQUIPMENT_IDENTIFIER_GAS, equipment)
|
||||
mbus_device.add(obis_references.HOURLY_GAS_METER_READING, gas_reading)
|
||||
mbus_device.add(obis_references.DEVICE_TYPE, device_type, "DEVICE_TYPE")
|
||||
mbus_device.add(obis_references.EQUIPMENT_IDENTIFIER_GAS, equipment, "EQUIPMENT_IDENTIFIER_GAS")
|
||||
mbus_device.add(obis_references.HOURLY_GAS_METER_READING, gas_reading, "HOURLY_GAS_METER_READING")
|
||||
|
||||
self.mbus_device = mbus_device
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import datetime
|
||||
import pytz
|
||||
|
||||
from dsmr_parser import telegram_specifications, obis_references
|
||||
from dsmr_parser import obis_name_mapping
|
||||
|
||||
from dsmr_parser.objects import CosemObject
|
||||
from dsmr_parser.objects import MBusObject
|
||||
from dsmr_parser.objects import ProfileGenericObject
|
||||
@@ -314,8 +314,8 @@ class TelegramTest(unittest.TestCase):
|
||||
self.item_names_tested.append(testitem_name)
|
||||
|
||||
# check if all items in telegram V4 specification are covered
|
||||
V4_name_list = [obis_name_mapping.EN[signature] for signature, parser in
|
||||
telegram_specifications.V4['objects'].items()]
|
||||
V4_name_list = [object["value_name"] for object in
|
||||
telegram_specifications.V4['objects']]
|
||||
V4_name_set = set(V4_name_list)
|
||||
item_names_tested_set = set(self.item_names_tested)
|
||||
|
||||
@@ -329,7 +329,7 @@ class TelegramTest(unittest.TestCase):
|
||||
break
|
||||
|
||||
# Verify that the iterator works for at least one value
|
||||
self.assertEqual(obis_name, obis_name_mapping.EN[obis_references.P1_MESSAGE_HEADER])
|
||||
self.assertEqual(obis_name, "P1_MESSAGE_HEADER")
|
||||
self.assertEqual(dsmr_object.value, '50')
|
||||
|
||||
def test_mbus_devices(self):
|
||||
|
||||
Reference in New Issue
Block a user