Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
  • Gurux Club
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. GXDLMSTranslator not showing data in PDU

GXDLMSTranslator not showing data in PDU

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By Zappa, 6 March, 2023
Forums
Gurux.DLMS

Good morning,

I am trying to translate with the Python library a frame received from a meter Zener BK04ZENNER01.

If I introduce data in the program Gurux Director, I manage to translate it well.
Without key:

<WRAPPER len="67" >
<SourceAddress Value="1" />
<TargetAddress Value="1" />
<PDU>
<!-- UNI/TS system title:
Manufacturer: XXX
Serial number: XXXXXXX
-->
<GeneralGloCiphering>
<SystemTitle Value="8305053800000503" />
<CipheredService Value="30000002A5A808A0B002E28B42E7292546AA24198E067FD66C4F3C5F61BFBD1703B37853F70D6213E70240C775712406D34A6C891534903B" />
</GeneralGloCiphering>
</PDU>
</WRAPPER>

With key:

<WRAPPER len="67" >
<SourceAddress Value="1" />
<TargetAddress Value="1" />
<PDU>
<!-- UNI/TS system title:
Manufacturer: XXX
Serial number: XXXX
-->
<!-- Invocation Counter: 677 -->
<!-- Decrypt data: 0F 00 00 00 15 00 02 01 09 1D 2F 64 02 FE 84 00 81 01 01 00 0A 00 A7 00 00 00 00 00 CC 00 00 00 00 01 00 00 00 21 01
<DataNotification>
# Invoke ID: 21
<LongInvokeIdAndPriority Value="21" />
# 01/01/0001 0:00:00
<DateTime Value="" />
<NotificationBody>
<DataValue>
<Structure Qty="1" >
<OctetString Value="2F6402FE8400810101000A00A70000000000CC00000000010000002101" />
</Structure>
</DataValue>
</NotificationBody>
</DataNotification>
-->
<GeneralGloCiphering>
<SystemTitle Value="8305053800000503" />
<CipheredService Value="30000002A5A808A0B002E28B42E7292546AA24198E067FD66C4F3C5F61BFBD1703B37853F70D6213E70240C775712406D34A6C891534903B" />
</GeneralGloCiphering>
</PDU>
</WRAPPER>

But with the python code:

from gurux_dlms import GXDLMSTranslator
from gurux_dlms import GXByteBuffer

data = "0001000100010043db0883050538000005033830000002a5a808a0b002e28b42e7292546aa24198e067fd66c4f3c5f61bfbd1703b37853f70d6213e70240c775712406d34a6c891534903b"
t = GXDLMSTranslator()
t.comments = True
t.systemTitle = "ABCDFG".encode()
t.blockCipherKey = bytearray((…….))
t.authenticationKey = bytearray((…….))
print(t.messageToXml(data))

I only get it to show me:

<WRAPPER len="4B" >
<TargetAddress Value="1" />
<SourceAddress Value="1" />
<PDU>
<GeneralGloCiphering>
<SystemTitle Value="8305053800000503" />
<CipheredService Value="30000002A5A808A0B002E28B42E7292546AA24198E067FD66C4F3C5F61BFBD1703B37853F70D6213E70240C775712406D34A6C891534903B" />
</GeneralGloCiphering>
</PDU>
</WRAPPER>

What could be happening?

Thank you so much

Zappa

2 months 4 weeks ago

I have been doing more tests…

I have been doing more tests with the library, just for more information...Has it maybe to do with that it follows the Italian standard?
I tried different tests with plots that you gave as an example in some forum posts and the comments do come out with the plot information, but in my case it does not show it to me

Thank you

Profile picture for user Kurumi

Kurumi

2 months 3 weeks ago

Hi, DLMS is using symmetric…

Hi,

DLMS is using symmetric ciphering and I believe that your client system tile is not correct.
It must be 8 bytes long and the same that is used when the frame is generated.

t.systemTitle = "ABCDFG".encode()

Check that first.

BR,
Mikko

jrudilla

2 months 3 weeks ago

Thanks for your answer. This…

Thanks for your answer.

This was my question but due to password recovery problems I couldn't write it myself so a colleague wrote it for me, I'll solve it now.

I also tried it with that and it didn't work. I have been able to "solve" it, I think there may be a problem in the library for the Italian version, specifically by changing two functions I have been able to get it to show me the data.

In this functión in _GXCommon.py

def decryptManufacturer(cls, value):
tmp = (value >> 8 | value << 8)
c = str(((tmp & 0x1f) + 0x40))
tmp = (tmp >> 5)
c1 = str(((tmp & 0x1f) + 0x40))
tmp = (tmp >> 5)
c2 = str(((tmp & 0x1f) + 0x40))
return str(c2, c1, c)

The str() function only takes one string argument, but three arguments are being passed in the last line.

I change with this.
def decryptManufacturer(cls, value):
tmp = (value >> 8 | value << 8)
c = ((tmp & 0x1f) + 0x40)
tmp = (tmp >> 5)
c1 = ((tmp & 0x1f) + 0x40)
tmp = (tmp >> 5)
c2 = ((tmp & 0x1f) + 0x40)
return "{}{}{}".format(chr(c2), chr(c1), chr(c))#Change

Then in GXByteBuffer.py,
def toHex(self, addSpace=True, index=0, count=None):
if count is None:
count = len(self) - index
return self.hex(self._data, addSpace, index, count)

It told me that sel._data was not a bytearray. I changed with this:

def toHex(self, addSpace=True, index=0, count=None, option=None):
bytearrayHex = bytearray(self)
if count is None:
count = len(self) - index
return GXByteBuffer.hex(bytearrayHex, addSpace, index, count)

After these changes I have managed to get the same parameters in the gurux director
<PDU>
<!--
UNI/TS system title:
Manufacturer: ALC
Serial number: 030500003805-->
<GeneralGloCiphering>
<SystemTitle Value="8305053800000503" />
<CipheredService Value="30000002A5A808A0B002E28B42E7292546AA24198E067FD66C4F3C5F61BFBD1703B37853F70D6213E70240C775712406D34A6C891534903B" />
</GeneralGloCiphering>
</PDU>

I am not an expert in python and less in dlms but at least that way I have managed to get the information out of me, I don't know if this will be the correct way

Thank you for this amazing library and your help, it helps me a lot

Profile picture for user Kurumi

Kurumi

2 months 2 weeks ago

In reply to Thanks for your answer. This… by jrudilla

Hi, Thank you for this…

Hi,

Thank you for this information. I believe the decryptManufacturer is an issue and it's fixed for the next release.

toHex issue looks odd. I have one Italy meter on my table at the moment. I'll test this and get back to this issue later today.

BR,
Mikko

  • Log in or register to post comments
  • Create new account
  • Reset your password

Hire Us!

Latest Releases

Fri, 06/02/2023 - 14:13
GXDLMSDirector 9.0.2306.0201
Fri, 06/02/2023 - 13:51
Gurux.DLMS.Net 9.0.2306.0201
Fri, 06/02/2023 - 10:33
Gurux.DLMS.AMI4 4.0.2306.0201
Thu, 06/01/2023 - 16:39
Gurux.DLMS.AMI4 4.0.2306.0101
Thu, 06/01/2023 - 15:25
gurux.dlms.cpp 20230601.1

Open bugs

gurux.dlms.c
4
gurux.dlms.cpp
3
gurux.dlms.delphi
1

New forum topics

  • Optical port
  • Unable to connect - Unhandled exception.
  • Reading objects in US Association
  • Error when trying to read meter with GXDLMSDirector.
  • Meter without user
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin