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. Unable To Read Data From Smart Meter (GPRS)

Unable to read data from smart meter (GPRS)

By carlituus , 24 February, 2025
Forums
Gurux.DLMS

Hi,

I am having issues reading data from a smart meter that pushes messages over UDP. The meter has a dynamic IP address, so I cannot initiate a direct connection to it. Instead, I am receiving the data in the OnReceived event.

However, when I try to send a request back to the meter, the media object is already in use, and the send operation fails.

My Questions:
- Do I need to create a new connection for sending data back to the meter, or can I reuse the existing UDP connection?
- Since the meter has a dynamic IP, how should I properly manage the connection to send requests back when needed?
- If I send multiple requests using the UDP connection, does the Gurux library wait for a response, or is the response also retrieved in the OnReceived event?
I appreciate any guidance or best practices on handling UDP communication with the smart meter using Gurux libraries.

Thanks in advance!

Profile picture for user Kurumi

Kurumi

1 year 3 months ago

Hi, - Don't create a new…

Hi,

- Don't create a new connection. You need use the connection that the meter has established.

- I believe that your meter sends initialize message when UDP connection is established. If that is the case, you need to listen OnReceived and attach the UDP connection. Like this:

GXNet media = server.Attach(e);

- You can send only one request at a time to the meter. You must attach the connection. Check also this:

https://github.com/Gurux/Gurux.DLMS.AMI4/blob/77dbfa56684c1d8484f0a9ba6…

BR,
Mikko

carlituus

1 year 3 months ago

Hi Mikko, thanks for your…

Hi Mikko, thanks for your quick reply.

I was trying to attach the connection to the sender and then read the meter, but I got an error saying "ipSettings cannot be null" or something similar (it was a few days ago).

I gave up on that approach and started reusing the connection. Now, I’m trying to read the Clock object to test if it works, but I can’t understand the error.
This is my code at this moment:

GXDLMSData obj = new GXDLMSData
{
LogicalName = logicalName
};

byte[][] requests = client.Read(obj, attributeId);

//byte[] responseBytes = Encoding.ASCII.GetBytes("OK");
//connection.Send(responseBytes, responseBytes.Length);

// REUSE EXISTING CONNECTION TO SEND REQUEST
foreach (var request in requests)
{
Console.WriteLine($" Sending request: {BitConverter.ToString(request)}");

connection.Send(request, request.Length);
}

LogicalName will be "0.0.1.0.0.255" and attributeId is 2.

- I am getting the message with the instant values, and then I need to send all requests (there might be more than 1. So you are saying I need to send the next request after I receive the previous one's response?). I set properly the keys and system title so I am able to translate it thanks to translator class.

When sending the request for the Clock object, this is what I send and what I get:

?? Requesting OBIS 0.0.1.0.0.255, Attribute 2...
?? Sending request: 00-01-00-01-00-01-00-14-C8-12-20-00-00-00-00-71-A9-16-28-6F-B6-34-7B-F9-E0-B0-E9-AE

Received Raw Data: 00-01-00-01-00-01-00-03-D8-01-02

When I try to translate the request within Gurux DLMS Translator tool, I get:

BlockCipher key: 83 1A 17 11 6C 24 9E 49 44 52 ED DA AD 33 E0 A1
Authentication Key:83 1A 17 11 6C 24 9E 49 44 52 ED DA AD 33 E0 A1
1: 00 01 00 01 00 01 00 14 C8 12 20 00 00 00 00 71 A9 16 28 6F B6 34 7B F9 E0 B0 E9 AE
<WRAPPER len="14" >
<SourceAddress Value="1" />
<TargetAddress Value="1" />
<PDU>
<!-- Invocation Counter: 0 -->
<!-- Decrypt data: 4C 41 C2 F5 3E 6E CD A6 EE B6 A9 0A DB
# Decrypt failed. Different block cipher or authentiocation key is used to generate this.
-->
<glo_GetRequest Value="200000000071A916286FB6347BF9E0B0E9AE" />
</PDU>
</WRAPPER>

,which is strange, because it mentions that the block cipher to decrypt it is different...

Any ideas on what might be causing this?

Thanks again,

Carlos.

Profile picture for user Kurumi

Kurumi

1 year 3 months ago

Hi, The meter is returning…

Hi,

The meter is returning ServiceNotSupported error. I believe that you need to establish the connection to the meter by sending AARQ before you can read anything.

I believe that converting to XML fails because your system title is different.

BR,
Mikko

carlituus

1 year 3 months ago

Hi Mikko, I have asked the…

Hi Mikko,

I have asked the Manufacturer (Sagemcom) whether we need to initialize the connection by sending this AARQ request.

Meanwhile, I have been trying to send a AARQ request and I got the same response as I do when trying to read the Clock object. This is what I got now:

?? Sending AARQ request: 00-01-00-01-00-01-00-3F-60-3D-A1-09-06-07-60-85-74-05-08-01-03-A6-0A-04-08-00-00-00-00-00-00-00-00-8A-02-07-80-8B-07-60-85-74-05-08-02-00-BE-17-04-15-21-13-20-00-00-00-00-B0-A8-D7-28-68-E8-2B-1C-F8-82-51-B6-51-24

and response:
Raw Data: 00-01-00-01-00-01-00-03-D8-01-02.

- Regarding the system title, what I do is setting the Ciphering properties (the ones I use for translating the first UDP message I get):
1. System title as the server system title
2. BlockCipherKey - the meter key
3. AuthenticationKey - same as the meter key

Another question came up to my mind: When ciphered communication with the meter, the system tytle is included in the message, right? So, when I create the request that I am sending to the meter, is it being ciphered?

byte[][] requests = client.Read(obj, attributeId);

Thanks Mikko!

Profile picture for user Kurumi

Kurumi

1 year 3 months ago

Hi, Because your message is…

Hi,

Because your message is encrypted, I can't check the data. You have used Encryption only in Security and I believe that you need to change that to AuthenticationEncryption.

The system title is included in the message.

BR,
Mikko

carlituus

1 year 2 months ago

Hi Mikko, We just got a…

Hi Mikko,

We just got a response from the client confirming we don't need to send the AARQ as there is a pre-established association.

Thanks for your help. I'm able to send and receive a valid message for a Clock request.

Carlos.

Profile picture for user Kurumi

Kurumi

1 year 2 months ago

Hi, I'm glad that this was…

Hi,

I'm glad that this was solved. Auto connect is causing problems because it's implemented in so many different ways to meters. Only the meter manufacturer knows how it's implemented.

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
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin