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. Gurux.DLMS.Push.Listener.Example.python - Start Byte Missing (0x7E)

Gurux.DLMS.Push.Listener.Example.python - Start byte missing (0x7E)

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 alex.wala , 9 June, 2022
Forums
Gurux.DLMS

hi

using Gurux.DLMS.Push.Listener.Example.python with a Siemens IM 350 meter (via optical reader).

i get data from serial:

New data is received. COM3:7E
New data is received. COM3:A0 7B CF 00 02 00 23 13 62 B1 E6 E7 00 DB 08 53 4D 53 67 70 04 3E E7 61 20 00 54 70 3F 83 EC DE 75 78 F1 4E 0C 87 E3 35 21 0E 30 17 23 8E 5F A5 01 6D 66 5E AE 1F 34 77 B9 B5 87 D9 E5 57 3B 0B 3E 4E C3 37 AE 9A 39 46 47 3A 25 25 13 52 89 18 1A D5 5C CC A8 B1 9C 5C 05 A4 BD 5D 01 5B 72 16 1E 46 A2 25 28 D2 D7 E4 90 41 67 8D A6 D0 95 92 7B 0C 7B B3 A7 7D 37 D8 8C 44 15 7E

but this data cant be parsed as it is somehow splitted: first received 0x7e is missing on second line

if a do an e.data.insert(0, 0x7e) or comment self.reply.clear() (onReceived method, line 131) in the sample code (so do a data concat), the data can be xml-parsed correctly - and i get the right data.

so is this maybe a configuration setting to not omit first 0x7E byte ?
i know there is a eop setting, currently set for HDLC to 0x7E, that would explain the split - but if i change the eop to something else i always get one message data with 0x7E only and a second data line with the rest of the bytes...

thanks

Profile picture for user Kurumi

Kurumi

4 years ago

Hi,

Hi,

All the data is not necessarily to come simultaneously in one frame and there might be 0x7E in the middle of the frame. For that reason, data is read until 0x7E is received.

New data is received message shown data that is read from the serial port.

Received bytes are saved for the receiver buffer and that buffer is used to parse the data after all the bytes are received. Because the data is encrypted, you need to set ciphering settings (block cipher and authentication keys) before the data can be parsed.

BR,
Mikko

alex.wala

4 years ago

All the data is not

>>> All the data is not necessarily to come simultaneously in one frame and there might be 0x7E in the middle of the frame. For that reason, data is read until 0x7E is received.

yea correct, but there is a 0x7E at the begin and a 0x7E at the end of the frame: 0x7e ..... 0x7e

i think the sample push code do a wrong clear of the self.reply - so it will not concat bytes:

currently:
try:
if not self.client.getData(self.reply, data, self.notify):
self.reply.clear()
#If all data is received.
if self.notify.complete:
if not self.notify.isMoreData():
#Show received data as XML.

working with modification:
try:
if not self.client.getData(self.reply, data, self.notify):
#self.reply.clear()
#If all data is received.
if self.notify.complete:
self.reply.clear()
if not self.notify.isMoreData():
#Show received data as XML.

also in the Gurux.DLMS.Net GXDLMSPushListener.cs example the clearing is done AFTER notify.IsComplete - and not before

client.GetData(reply, data, notify);
// If all data is received.
if (notify.IsComplete)
{
reply.Clear();

what about the start 0x7E ?

Profile picture for user Kurumi

Kurumi

4 years ago

Hi,

Hi,

I believe that you are right and that line should be lower. There might be a bug in the Python code. This is tested next week. Let's wait for the results.

BR,
Mikko

alex.wala

4 years ago

In reply to Hi, by Kurumi

Thank you for your prompt

Thank you for your prompt reply !!!

Profile picture for user Kurumi

Kurumi

3 years 12 months ago

Hi,

Hi,

This is fixed for the listener example and your name is added for the CREDITS.md.

BR,
Mikko

alex.wala

3 years 12 months ago

Wow thank you !

Wow thank you !

  • 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