Python Push Listener

5 posts / 0 new
Last post
Python Push Listener


I was very happy to see that you provided a full example to receive and decrypt push messages from the meter with python a couple of days ago!

but after testing it I noticed that you read the serial until you encounter 7E but this byte can also occur as part of the "regular packet". its even quite often because if I let the python push listener run even though I get a push message every second, only once every 20 seconds a packet is received correctly and can be decrypted.

this issue bugged me also while trying to implement a simple serial reader script myself... and when I saw you provided an example I was hopefull that you figured it out how to read the push packet without relying on "reading until 7E" but instead something like... buffer the serial input until its a correct HDLC packet (with matching CRC and length data etc.)

I'm not sure how to tackle this problem so that its solved "correctly".
Maybe its something like: Read the serial and if the first byte you read is NOT 7E stop reading because we are "in the middle" of a packet.. (there is still the edge case that we could start reading in the middle of a serial burst and it COULD start with a 7E...)
so maybe the lib should then read the next bytes where the length of the whole packet is defined and then serial read only for this amount? so its save to assume that a whole DLMS push packet is in the buffer?

Happy for your thoughts on this...


Kurumi's picture

Hi Tobias,

Can you post one of the failed messages here so we can test with that?

Mikko Kurunsaari
Gurux Ltd


I've uploaded the file for you here:

the command was:
python3 -S /dev/ttyS7 -t Verbose -B X...X

and by the way:
on the WSL (windows subsystem on linux) bash the "available devices" is always empty.
but for example lists them all.

my naive approach was to just read 105 Bytes and check if first and last byte are the same... but I also saw that not all austrian smart meters send 105 Bytes long messages...



Hello Tobias, I'm from Austria and I'm currently reading my smart meter. Can you give me a link for example a code?

And if you want, we can also keep in touch via e-mail


Hi, you need help with your mbus interface so you should check out this: