Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

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

Breadcrumb

  1. Home
  2. Forums
  3. Arduino Decryption

Arduino decryption

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 greenMike , 27 April, 2021
Forums
Gurux.DLMS

Hello, is there an example code to read out a smart meter for Lower Austria EVN (Netz Niederösterreich) based on an arduino? Is the decryption also available for the Arduino.

Under Phyton and a raspberry I managed to do it now with an Arduino.
I want to process everything on the Arduino and output it via a web interface or save it on an SD card.

Mike

Profile picture for user Kurumi

Kurumi

5 years 1 month ago

Hi,

Hi,

You can do it with the Arduino example. You need to change the client and server address and then set ciphering settings. I can show what you need to do If you post python settings here.

https://github.com/Gurux/GuruxDLMS.c/tree/master/Arduino_IDE/client

BR,
Mikko

greenMike

5 years 1 month ago

Hello,

Hello,

Can I send you the Python program privately? To which email address?

However, it is not a normal Mbus interface; it is only an output of the data.

BR
Mike

Profile picture for user Kurumi

Kurumi

5 years 1 month ago

Hi,

Hi,

You want only to receive incoming push messages from the meter and you don't want to read anything from the meter?

BR,
Mikko

greenMike

5 years 1 month ago

Hello,

Hello,

The smart meter gives me the data every 5 seconds and I want to read and decrypt them with an Arduino.

I cannot transmit any data or commands to the smart meter.

The data line is an RJ-10 connector with Mbus + and Mbus-.

BR
Mike

Profile picture for user Kurumi

Kurumi

5 years 1 month ago

Hi,

Hi,

OK. Then you don't do anything with the client example. You need push example and it's not implemented for Arduino at the moment.
https://github.com/Gurux/GuruxDLMS.c/tree/master/GuruxDLMSPushExample

It's not hard to implement, but it will take some time before we can implement it.
I'll add it to the worklist. Ask again after next week if I haven't replied to this.

BR,
Mikko

greenMike

5 years 1 month ago

Hello,

Hello,

thanks for the quick reply you could also post an example on github. And I'll get back to you next week. Have a nice day at work.

BR,
Mike

greenMike

5 years ago

Hello,

Hello,
I just wanted to remind her briefly.

BR,
Mike

Profile picture for user Kurumi

Kurumi

5 years ago

Hi,

Hi,

Tests are in progress. I believe it's released today.

BR,
Mikko

greenMike

5 years ago

Hello,

Hello,
thanks for the answer you don't need to stress yourself unnecessarily if it is not finished today. If it is finished this week or next week, it is completely sufficient.

BR,
Mike

Profile picture for user Kurumi

Kurumi

5 years ago

Hi,

Hi,

Push listener is released for Arduino.
https://github.com/Gurux/GuruxDLMS.c/tree/master/Arduino_IDE/pushListen…

It listens push messages from one serial port and prints content of the push message to another serial port.
Note! You need to define what kind of data the meter is sending. You can get this information if you can read push object list from the Push object.

greenMike

4 years 5 months ago

Hello, can you check my data.

Hello, can you check my data. Please

68fafa6853ff000167db084b464d65509a177781f820000c41712749cc29f568b4b44f7f0b62cd71325da2a0415219ffc3c7b15b8f30270840031afe7e96f9d9873de4ab83b95254477fac2f87ff3fb472cf9400dffb07a755b958fcfd81bf41054f23a6bec9cf5256645862856adc05331ac49c761e43a6992ba07eff07e06b400e00c7e4faca9a98c718c6ab024b1871a5cc09317714202fb05172324252952aec417aee676e1954946d7ec06b74ba3831d827b91f38db3f3637faa8395c6478c12bc0c2a223de0708c647c423017226fdf5ebb85c6d3877044d223e71913fd7a05a7ac737da0cc705b70b4d3b08096bbe77042a98380873f778ac92fe9e166814146853ff1101674a49eebd9694f8cbf47e536ca2fafec116

Key
D833BE8602D029CEA517867835550816

The meter is a Kaifa MA309

I can decrypt the data but unfortunately I cannot translate it.

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi,

Hi,

Your meter is sending a wired M-Bus message, but all the data can't fit into one frame. You need to send a few messages that the meter is sending so it's possible to parse the data.

BR,
Mikko

greenMike

4 years 5 months ago

Thank you for your prompt

Thank you for your prompt reply.

I have the network operator EVN and this company offers two meters, the Sagemcom three-phase energy meter T210-D and the Kaifa three-phase energy meter MA309.

I can decrypt and translate the data from the T210-D but not the one from the Kaifa. Are they using a different protocol?

https://www.netz-noe.at/Download-(1)/Smart-Meter/218_9_SmartMeter_Kunde…

That is the documentation and there is no difference made.

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi,

Hi,

It seems that both are using DLMS, but the framing is different. Kaifa is using M-Bus framing and Sagemcom HDLC. You should parse both if you change the InterfaceType. In default it's HDLC.

BR,
Mikko

greenMike

4 years 5 months ago

I program in python and use

I program in python and use this funktion. Can I transfer parameters for Mbus framing?

tr = GXDLMSTranslator()
tr.pduToXml(pdu_from_the_meter)

Is it possible to select this MBUS framing in the desktop version of the Gurux DLMS Director?

Greetings and thank you for your work

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi,

Hi,

Yes, you can select MBusWired for GXDLMSDirector. I notest that Mbus framing for Python is not released as an open-source. It's released later this week.

BR,
Mikko

greenMike

4 years 5 months ago

I tried it but unfortunately

I tried it but unfortunately I always get Invalid data type.

Krypted Data:
68fafa6853ff000167db084b464d65509a177781f820000c41712749cc29f568b4b44f7f0b62cd71325da2a0415219ffc3c7b15b8f30270840031afe7e96f9d9873de4ab83b95254477fac2f87ff3fb472cf9400dffb07a755b958fcfd81bf41054f23a6bec9cf5256645862856adc05331ac49c761e43a6992ba07eff07e06b400e00c7e4faca9a98c718c6ab024b1871a5cc09317714202fb05172324252952aec417aee676e1954946d7ec06b74ba3831d827b91f38db3f3637faa8395c6478c12bc0c2a223de0708c647c423017226fdf5ebb85c6d3877044d223e71913fd7a05a7ac737da0cc705b70b4d3b08096bbe77042a98380873f778ac92fe9e166814146853ff1101674a49eebd9694f8cbf47e536ca2fafec116

Dekryptedt:
0f803c22190c07e50c140113383700ffc4000223090c07e50c140113383700ffc40009060100010800ff060025c73a02020f00161e09060100020800ff06001aea2b02020f00161e09060100010700ff060000023f02020f00161b09060100020700ff060000000002020f00161b09060100200700ff1208fb02020fff162309060100340700ff1208f802020fff162309060100480700ff1208ff02020fff1623090601001f0700ff1200c002020ffe162109060100330700ff12003202020ffe162109060100470700ff1200b102020ffe1621090601000d0700ff1202c202020ffd162b568a98bacd9905d54f0d1ede2172b8256737169521bb4796a6

Gurux DLMS Translater: Interface WiredMBus Show messages: All Follow messages:None

greenMike

4 years 5 months ago

I tried it but unfortunately

I tried it but unfortunately I always get Invalid data type.

Krypted Data:
68fafa6853ff000167db084b464d65509a177781f820000c41712749cc29f568b4b44f7f0b62cd71325da2a0415219ffc3c7b15b8f30270840031afe7e96f9d9873de4ab83b95254477fac2f87ff3fb472cf9400dffb07a755b958fcfd81bf41054f23a6bec9cf5256645862856adc05331ac49c761e43a6992ba07eff07e06b400e00c7e4faca9a98c718c6ab024b1871a5cc09317714202fb05172324252952aec417aee676e1954946d7ec06b74ba3831d827b91f38db3f3637faa8395c6478c12bc0c2a223de0708c647c423017226fdf5ebb85c6d3877044d223e71913fd7a05a7ac737da0cc705b70b4d3b08096bbe77042a98380873f778ac92fe9e166814146853ff1101674a49eebd9694f8cbf47e536ca2fafec116

Dekryptedt:
0f803c22190c07e50c140113383700ffc4000223090c07e50c140113383700ffc40009060100010800ff060025c73a02020f00161e09060100020800ff06001aea2b02020f00161e09060100010700ff060000023f02020f00161b09060100020700ff060000000002020f00161b09060100200700ff1208fb02020fff162309060100340700ff1208f802020fff162309060100480700ff1208ff02020fff1623090601001f0700ff1200c002020ffe162109060100330700ff12003202020ffe162109060100470700ff1200b102020ffe1621090601000d0700ff1202c202020ffd162b568a98bacd9905d54f0d1ede2172b8256737169521bb4796a6

Gurux DLMS Translater: Interface WiredMBus Show messages: All Follow messages:None

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi,

Hi,

There are two frames in your data. you need to find them with FindNextFrame and convert using MessageToXml, not PduToXml method.
Decrypted data is below.

BR,
Mikko

<DataNotification>
# High priority.
# Invoke ID: 3940889
<LongInvokeIdAndPriority Value="803C2219" />
# 20.12.2021 20.56.55
<DateTime Value="07E50C140113383700FFC400" />
<NotificationBody>
<DataValue>
<Structure Qty="23" >
# 20.12.2021 19.56.55+01:00
<OctetString Value="07E50C140113383700FFC400" />
# 1.0.1.8.0.255
<OctetString Value="0100010800FF" />
<UInt32 Value="0025C73A" />
<Structure Qty="02" >
<Int8 Value="00" />
<Enum Value="1E" />
</Structure>
# 1.0.2.8.0.255
<OctetString Value="0100020800FF" />
<UInt32 Value="001AEA2B" />
<Structure Qty="02" >
<Int8 Value="00" />
<Enum Value="1E" />
</Structure>
# 1.0.1.7.0.255
<OctetString Value="0100010700FF" />
<UInt32 Value="0000023F" />
<Structure Qty="02" >
<Int8 Value="00" />
<Enum Value="1B" />
</Structure>
# 1.0.2.7.0.255
<OctetString Value="0100020700FF" />
<UInt32 Value="00000000" />
<Structure Qty="02" >
<Int8 Value="00" />
<Enum Value="1B" />
</Structure>
# 1.0.32.7.0.255
<OctetString Value="0100200700FF" />
<UInt16 Value="08FB" />
<Structure Qty="02" >
<Int8 Value="FFFFFFFFFFFFFFFF" />
<Enum Value="23" />
</Structure>
# 1.0.52.7.0.255
<OctetString Value="0100340700FF" />
<UInt16 Value="08F8" />
<Structure Qty="02" >
<Int8 Value="FFFFFFFFFFFFFFFF" />
<Enum Value="23" />
</Structure>
# 1.0.72.7.0.255
<OctetString Value="0100480700FF" />
<UInt16 Value="08FF" />
<Structure Qty="02" >
<Int8 Value="FFFFFFFFFFFFFFFF" />
<Enum Value="23" />
</Structure>
# 1.0.31.7.0.255
<OctetString Value="01001F0700FF" />
<UInt16 Value="00C0" />
<Structure Qty="02" >
<Int8 Value="FFFFFFFFFFFFFFFE" />
<Enum Value="21" />
</Structure>
# 1.0.51.7.0.255
<OctetString Value="0100330700FF" />
<UInt16 Value="0032" />
<Structure Qty="02" >
<Int8 Value="FFFFFFFFFFFFFFFE" />
<Enum Value="21" />
</Structure>
# 1.0.71.7.0.255
<OctetString Value="0100470700FF" />
<UInt16 Value="00B1" />
<Structure Qty="02" >
<Int8 Value="FFFFFFFFFFFFFFFE" />
<Enum Value="21" />
</Structure>
# 1.0.13.7.0.255
<OctetString Value="01000D0700FF" />
<UInt16 Value="02C2" />
<Structure Qty="02" >
<Int8 Value="FFFFFFFFFFFFFFFD" />
<Enum Value="FF" />
</Structure>
# 181210098551
<OctetString Value="313831323130303938353531" />
</Structure>
</DataValue>
</NotificationBody>
</DataNotification>

greenMike

4 years 5 months ago

I tried it but unfortunately

I tried it but unfortunately it doesn't work. I also looked at the function on github but I don't understand which parameters are what.

def findNextFrame (self, data, pdu):

as which parameter do I have to transfer my decrypted data?

and what do I get back just a number with the length where the next message begins?
and whicht datatype is needed for the return ?

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi,

Hi,

As I told you before the open-source version from MBus is not released for Python. It's released later today.

BR,
Mikko

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi,

Hi,
Get the latest version.
You can use it like this:
translator = GXDLMSTranslator()
translator.blockCipherKey = GXByteBuffer("D833BE8602D029CEA517867835550816")
translator.comments = True
pdu_from_the_meter = "68fafa6853ff000167db084b464d65509a177781f820000c41712749cc29f568b4b44f7f0b62cd71325da2a0415219ffc3c7b15b8f30270840031afe7e96f9d9873de4ab83b95254477fac2f87ff3fb472cf9400dffb07a755b958fcfd81bf41054f23a6bec9cf5256645862856adc05331ac49c761e43a6992ba07eff07e06b400e00c7e4faca9a98c718c6ab024b1871a5cc09317714202fb05172324252952aec417aee676e1954946d7ec06b74ba3831d827b91f38db3f3637faa8395c6478c12bc0c2a223de0708c647c423017226fdf5ebb85c6d3877044d223e71913fd7a05a7ac737da0cc705b70b4d3b08096bbe77042a98380873f778ac92fe9e166814146853ff1101674a49eebd9694f8cbf47e536ca2fafec116"
msg = GXDLMSTranslatorMessage()
msg.message = GXByteBuffer(pdu_from_the_meter)
xml = ""
pdu = GXByteBuffer()
translator.completePdu = True
while translator.findNextFrame(msg, pdu):
pdu.clear()
xml += translator.messageToXml(msg)
if msg.moreData == RequestTypes.NONE:
break

BR,
Mikko

greenMike

4 years 5 months ago

Hello i try it but it doesnt

Hello i try it but it doesnt work

my imports
from gurux_dlms.GXByteBuffer import GXByteBuffer
from gurux_dlms.GXDLMSTranslator import GXDLMSTranslator
import gurux_dlms

This is the issue
Traceback (most recent call last):
File "c:\Users\admin\Desktop\Python Programme\Mining\SmartMeterKaifa.py", line 9, in <module>
from gurux_dlms.GXDLMSTranslator import GXDLMSTranslator
File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\gurux_dlms\__init__.py", line 47, in <module>
from .GXDLMS import GXDLMS
File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\gurux_dlms\GXDLMS.py", line 68, in <module>
from .plc.enums import PlcDataLinkData, PlcHdlcSourceAddress, PlcMacSubframes, PlcSourceAddress, PlcDestinationAddress
ModuleNotFoundError: No module named 'gurux_dlms.plc

and that is not recognized in the IDE as if it is not present
GXDLMSTranslatorMessage()

The Version is correct i think
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: gurux_dlms in ./.local/lib/python2.7/site-packages (1.0.116)

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi,

Hi,

plc folder was empty and it was removed on deployment. This is now fixed. Update to the latest version.

BR,
Mikko

greenMike

4 years 5 months ago

Hello

Hello
thank you i solve all problems

BR Michael

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hello Michael,

Hello Michael,

Thanks for letting me know.

BR,
Mikko

Norbert

4 years 2 months ago

In reply to Hi, by Kurumi

Hello

Hello
is the result of this discussion, a code snippet, available on Github?
Want to do the same with ESP32: EVN smartmeter, one Kaifa and one Sagemcom... notification ever 5 seconds.
Thanks
Norbert

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

In reply to Hello by Norbert

Hi Norbert,

Hi Norbert,
Please, create a new topic if you have a new question. I'll answer your question there.
https://www.gurux.fi/ForumRules

BR,
Mikko

preslmayer

4 years 1 month ago

Hi Mikko. Can you please tell

Hi Mikko. Can you please tell me how the python code from post #25 works in Java?
It is not working for me. I used the same data which is used in post #25.

It get the following Exception in method findNextFrame:
Exception in thread "main" java.lang.IllegalArgumentException: getUInt16
at gurux.dlms.GXByteBuffer.getUInt16(GXByteBuffer.java:377)
at gurux.dlms.GXDLMSTranslator.findNextFrame(GXDLMSTranslator.java:449)

thank you.

Profile picture for user Kurumi

Kurumi

4 years 1 month ago

Hi,

Hi,

Java doesn't support Wired MBus at the moment. I'll add it to the worklist and it's coming for the next release.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin