I am trying to read LoadProfile#2, so in GXSettings.py I've put objects as in:
self.readObjects = [("1.0.99.2.0.255", 3), ("1.0.99.2.0.255", 2)]
Then I executed main.py file. First data which appeared looked like that:
Index: 3 Value: (<gurux_dlms.objects.GXDLMSClock.GXDLMSClock object at 0x0000026B7BCE22D0>, <gurux_dlms.objects.GXDLMSCaptureObject.GXDLMSCaptureObject object at 0x0000026B7B1B7E10>), (<gurux_dlms.objects.GXDLMSData.GXDLMSData object at 0x0000026B7C2B7B10>, <gurux_dlms.objects.GXDLMSCaptureObject.GXDLMSCaptureObject object at 0x0000026B7B383C90>), (<gurux_dlms.objects.GXDLMSRegister.GXDLMSRegister object at 0x0000026B7C24AA90>, <gurux_dlms.objects.GXDLMSCaptureObject.GXDLMSCaptureObject object at 0x0000026B7BCE0A90>), (<gurux_dlms.objects.GXDLMSRegister.GXDLMSRegister object at 0x0000026B7C24B150>, <gurux_dlms.objects.GXDLMSCaptureObject.GXDLMSCaptureObject object at 0x0000026B7BE2E4D0>), (<gurux_dlms.objects.GXDLMSRegister.GXDLMSRegister object at 0x0000026B7C24BD50>, <gurux_dlms.objects.GXDLMSCaptureObject.GXDLMSCaptureObject object at 0x0000026B7BE286D0>), (<gurux_dlms.objects.GXDLMSRegister.GXDLMSRegister object at 0x0000026B7C250990>, <gurux_dlms.objects.GXDLMSCaptureObject.GXDLMSCaptureObject object at 0x0000026B7BE28710>), (<gurux_dlms.objects.GXDLMSRegister.GXDLMSRegister object at 0x0000026B7C251590>, <gurux_dlms.objects.GXDLMSCaptureObject.GXDLMSCaptureObject object at 0x0000026B7BE2AD10>), (<gurux_dlms.objects.GXDLMSRegister.GXDLMSRegister object at 0x0000026B7C252190>, <gurux_dlms.objects.GXDLMSCaptureObject.GXDLMSCaptureObject object at 0x0000026B7BE28550>)
And some time later I had something like that (it's cut, because it's too long):
Index: 2 Value: [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7BE2C490>, 8, 0, 0, 0, 0, 0, 0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7C845650>, 8, 0, 0, 0, 0, 0, 0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7BE2C550>, 8, 0, 0, 0, 0, 0, 0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7BDC3090>, 8, 0, 0, 0, 0, 0, 0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7BE2B090>, 8, 0, 0, 0, 0, 0, 0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7C8456D0>, 8, 0, 0, 0, 0, 0, 0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7BDF1D10>, 8, 0, 0, 0, 0, 0, 0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7BE23890>, 8, 0, 0, 0, 0, 0, 0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7BE23E50>, 8, 0, 0, 0, 0, 0,
0], [<gurux_dlms.GXDateTime.GXDateTime object at 0x0000026B7BED7550>, 8, 0, 0, 0, 0, 0, 0]
How can I make it show "normal" values, instead of objects? I want timestamps+all columns from LoadProfile#2. Also, I'd like to add 2-3 possible options for reading Profiles: read everything from LoadProfile / read by entry / read by date range. Meter is MCS/Metcom. I'm still learning python by the way, so I will be grateful if you'll put some python snippets! I know there are funcs like readRowsByRange or readRowsByEntry, but I'm not sure how to use them.
UPDATE: I added test…
UPDATE:
I added test-function to GXDLMSReader:
def testRead(self):
pg = GXDLMSProfileGeneric("1.0.99.2.0.255")
self.read(pg, 3)
start = datetime.datetime.now()
end = start
start = start.replace(hour=0, minute=0, second=0, microsecond=0)
end = end.replace(minute=0, second=0, microsecond=0)
cells = self.readRowsByRange(pg, start, end)
for rows in cells:
row = ""
for cell in rows:
if row:
row += " | "
if isinstance(cell, bytearray):
row += GXByteBuffer.hex(cell)
else:
row += str(cell)
self.writeTrace(row, TraceLevel.INFO)
And in main.py I've added line "reader.testRead()" if "not read". The output looks like below:
Authentication: 1
ClientAddress: 0x1
ServerAddress: 0x1
Standard: 0
Reading LP2
03/27/25 02:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 03:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 04:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 05:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 06:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 07:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 08:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 09:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 10:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 11:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 12:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 13:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 14:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 15:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
Reading LP2 ( / it's just my print() )
03/27/25 02:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 03:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 04:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 05:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 06:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 07:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 08:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 09:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 10:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 11:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 12:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 13:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 14:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
03/27/25 15:00:00 | 0 | 0 | 0 | 0 | 0 | 0 | 0
Traceback (most recent call last):
File "C:\Users\x\Desktop\GURUX\Gurux.DLMS.Python-master\Gurux.DLMS.Client.Example.python\main.py", line 79, in main
raise Exception("Unknown logical name:" + k)
Exception: Unknown logical name:1.0.99.2.0.255
Ended. Press any key to continue.
1) Why there's "Exception: Unknown logical name:1.0.99.2.0.255" if it did read something?
2) Also, how should I change "end" in my function testRead() if I want to choose when it should start and end?
3) Why did it print LP2 table two times (as you can see above)?
Hi, Check what you are doing…
Hi,
Check what you are doing after testRead. I believe that the reason is found in line 79.
BR,
Mikko
Hi Mikko, this function…
Hi Mikko,
this function apparently works, maybe it was meter issue or connection issue, but next readouts were okay. Thanks for response anyway!