Hello
running DLMS Translator at RPi4 and get this error:
Traceback (most recent call last):
while translator.findNextFrame(msg, pdu):
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMSTranslator.py", line 171, in findNextFrame
elif msg.interfaceType in (None, InterfaceType.WRAPPER) and data.getUInt16(data.position) == 0x1:
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXByteBuffer.py", line 321, in getUInt16
raise ValueError("getUInt16")
ValueError: getUInt16
The message comes from a Sagemcom T210-D, Austria, EVN
The problem is that the size of the payload is too high.
You can fix this if you modify GetWiredMBusData -method like this.
This is only ad hoc for your problem. When you set this you can decrypt your data to XML values. I did try with C#.
//L-field.
int len = buff.GetUInt8();
int len2 = buff.GetUInt8();
if (len == 1)
{
len2 = len = 257;
}
//L-field.
if (len2 != len ||
.....
today I get this error:
Traceback (most recent call last):
File "p1decrypter_singergasse.py", line 104, in <module>
smarty_proxy.main()
File "p1decrypter_singergasse.py", line 65, in main
self.process()
File "p1decrypter_singergasse.py", line 85, in process
while translator.findNextFrame(msg, pdu):
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMSTranslator.py", line 195, in findNextFrame
found = GXDLMS.getData(settings, data, reply, None)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMS.py", line 2269, in getData
GXDLMS.__getWirelessMBusData(settings, reply, target)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMS.py", line 1114, in __getWirelessMBusData
man = _GXCommon.decryptManufacturer(manufacturerID)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/internal/_GXCommon.py", line 1810, in decryptManufacturer
return str(c2, c1, c)
TypeError: decoding str is not supported
but I don't know was the reason for the change. Any idea?
Thanks
Norbert
Hi Mikko
same error:
File "p1decrypter_singergasse.py", line 91, in process
while t.findNextFrame(msg, pdu):
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMSTranslator.py", line 195, in findNextFrame
found = GXDLMS.getData(settings, data, reply, None)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMS.py", line 2269, in getData
GXDLMS.__getWirelessMBusData(settings, reply, target)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMS.py", line 1114, in __getWirelessMBusData
man = _GXCommon.decryptManufacturer(manufacturerID)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/internal/_GXCommon.py", line 1810, in decryptManufacturer
return str(c2, c1, c)
TypeError: decoding str is not supported
Are you using the same message as in the first topic?
I tested the code using this message and it worked without problems.
I believe that you haven't set the used interface type and the translator expects that this is a Wireless MBus message.
msg.interfaceType = InterfaceType.WIRED_MBUS
I'm running this without compile errors, but no data for the message from the Sagemcom above.
A message from another meter, Kaifa from EVN too, will be converted successfully.
What is the different ?
Thansk, Norbert
Hi Mikko
want to come back to this topic, because I don't get it running. Yesterday I got another smartmeter, a Sagemcom T210-D, EVN. For example I get this:
<WiredMBus len="11" >
<TargetAddress Value="67" />
<SourceAddress Value="1" />
<PDU>
<Data="7860F474867E74AF" />
</PDU>
</WiredMBus>
Any idea, why this works for the Kaifa, but doesn't for the Sagemcom ?
Thanks, Norbert
Hi Norbert,
Hi Norbert,
Lenght of L-field is invalid. It's one and that is not true. So this is a meter issue.
68
01 //WRONG. L-Field, length field, number of user data octets
BR,
Mikko
Hi,
Hi,
The problem is that the size of the payload is too high.
You can fix this if you modify GetWiredMBusData -method like this.
This is only ad hoc for your problem. When you set this you can decrypt your data to XML values. I did try with C#.
//L-field.
int len = buff.GetUInt8();
int len2 = buff.GetUInt8();
if (len == 1)
{
len2 = len = 257;
}
//L-field.
if (len2 != len ||
.....
BR,
Mikko
Hi Mikko
Hi Mikko
today I get this error:
Traceback (most recent call last):
File "p1decrypter_singergasse.py", line 104, in <module>
smarty_proxy.main()
File "p1decrypter_singergasse.py", line 65, in main
self.process()
File "p1decrypter_singergasse.py", line 85, in process
while translator.findNextFrame(msg, pdu):
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMSTranslator.py", line 195, in findNextFrame
found = GXDLMS.getData(settings, data, reply, None)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMS.py", line 2269, in getData
GXDLMS.__getWirelessMBusData(settings, reply, target)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMS.py", line 1114, in __getWirelessMBusData
man = _GXCommon.decryptManufacturer(manufacturerID)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/internal/_GXCommon.py", line 1810, in decryptManufacturer
return str(c2, c1, c)
TypeError: decoding str is not supported
but I don't know was the reason for the change. Any idea?
Thanks
Norbert
Hi,
Hi,
Try with this:
t = GXDLMSTranslator()
t.pduOnly = True
t.completePdu = True
t.comments = True
t.authenticationKey = t.blockCipherKey = GXByteBuffer.hexToBytes("B829C67DC9DF3D9A81068540AD4C13E1")
data = GXByteBuffer("METER_DATA")
pdu = GXByteBuffer()
msg = GXDLMSTranslatorMessage()
msg.interfaceType = InterfaceType.WIRED_MBUS
msg.message = data
while t.findNextFrame(msg, pdu):
print(t.messageToXml(data))
BR,
Mikko
Hi Mikko
Hi Mikko
same error:
File "p1decrypter_singergasse.py", line 91, in process
while t.findNextFrame(msg, pdu):
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMSTranslator.py", line 195, in findNextFrame
found = GXDLMS.getData(settings, data, reply, None)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMS.py", line 2269, in getData
GXDLMS.__getWirelessMBusData(settings, reply, target)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/GXDLMS.py", line 1114, in __getWirelessMBusData
man = _GXCommon.decryptManufacturer(manufacturerID)
File "/usr/local/lib/python3.7/dist-packages/gurux_dlms/internal/_GXCommon.py", line 1810, in decryptManufacturer
return str(c2, c1, c)
TypeError: decoding str is not supported
Thanks
Norbert
Hi Norbert,
Hi Norbert,
Are you using the same message as in the first topic?
I tested the code using this message and it worked without problems.
I believe that you haven't set the used interface type and the translator expects that this is a Wireless MBus message.
msg.interfaceType = InterfaceType.WIRED_MBUS
BR,
Mikko
Hi Mikko
Hi Mikko
I'm running this without compile errors, but no data for the message from the Sagemcom above.
A message from another meter, Kaifa from EVN too, will be converted successfully.
What is the different ?
Thansk, Norbert
def decryptSued(self, mySite, myKey, myMessage):
print('decryptSued ' + mySite + ' start...')
# use gurux_dlms package
translator = GXDLMSTranslator(TranslatorOutputType.SIMPLE_XML)
translator.comments = True
translator.completePdu = True
# set cipher key
translator.authenticationKey = translator.blockCipherKey = GXByteBuffer(myKey)
msg = GXDLMSTranslatorMessage()
msg.interfaceType = InterfaceType.WIRED_MBUS
msg.message = GXByteBuffer(myMessage)
xml = ""
pdu = GXByteBuffer()
while translator.findNextFrame(msg, pdu):
pdu.clear()
subXml = translator.messageToXml(msg)
print('decryptSued subXml ' + mySite + '>>>' + subXml)
xml += subXml
if msg.moreData == RequestTypes.NONE:
break
print('decryptSued xml ' + mySite + '>>>' + xml)
print('decryptSued ' + mySite + ' done.')
Hi Mikko
Hi Mikko
want to come back to this topic, because I don't get it running. Yesterday I got another smartmeter, a Sagemcom T210-D, EVN. For example I get this:
<WiredMBus len="11" >
<TargetAddress Value="67" />
<SourceAddress Value="1" />
<PDU>
<Data="7860F474867E74AF" />
</PDU>
</WiredMBus>
Any idea, why this works for the Kaifa, but doesn't for the Sagemcom ?
Thanks, Norbert
Hi Norbert,
Hi Norbert,
There is an issue in Sagemcom meter and because of that, the client can't parse the message. and the first frame is skipped.
http://www.gurux.fi/comment/23747#comment-23747
Ask if there is a firmware available where this is fixed. You can use the code I have shown above.
BR,
Mikko
Hi Mikko
Hi Mikko
All right! I'm in contact with EVN...
Maybe you have a link to the specification of the M-Bus message / frame ?
Thanks,
Norbert
Hi Norbert,
Hi Norbert,
M-Bus message is defined on DLMS standard. Problem is L-Field, length field, number of user data octets.ยจ
BR,
Mikko
Hi Mikko
Hi Mikko
the issue is accepted by EVN, thanks for your support.
br
Norbert
Hi Norbert,
Hi Norbert,
Thank you for letting me know about this. I hope that this is solved fast and you can start to read your meter.
BR,
Mikko