skagmo / meter_reading

21 stars 11 forks source link

Unable to parse aidon data #2

Closed ways closed 2 years ago

ways commented 2 years ago

Hi

I'm passing data via Tibber pulse -> mqtt -> this script, but it's unable to decode any data. I get no errors.

In hex a typical file looks like this:

root@chewbacca:~/aidon# hexdump out.bin 0000000 a07e 412a 8308 0413 e613 00e7 400f 0000 0000010 0000 0101 0302 0609 0001 0701 ff00 0006 0000020 0a00 02d8 0f02 1600 431b 7e2b
000002c

How can I check if my data is valid at all?

skagmo commented 2 years ago

Hi. The Tibber Pulse should provide parsed/decoded data for you, so you shouldn't need this script at all. This script is meant as a replacement for e.g. Tibber Pulse, by using a M-bus transceiver directly connected to the HAN port on your meter.

ways commented 2 years ago

Hi. The Tibber Pulse should provide parsed/decoded data for you, so you shouldn't need this script at all. This script is meant as a replacement for e.g. Tibber Pulse, by using a M-bus transceiver directly connected to the HAN port on your meter.

No, when used locally (not via tibber) the pulse dumps all data from the AMS, untouched, via mqtt.

I was able to parse the instant usage from my quoted hex, but would like to use your code to parse all of the messages.

skagmo commented 2 years ago

Alright, sorry, I've never had a Tibber Pulse and assumed the MQTT data would be processed. I can see the 0x7e flags in your data so it is indeed raw.

If so you need to modify aidon_forward.py quite a lot. Add a MQTT library (like paho-mqtt) and set up a listener for your topic. When you get the binary data you iterate through every single byte and pass it to the decoder with a.decode(byte). In other words remove the while loop with a.decode(ser.read(1)).

ways commented 2 years ago

Aha, byte by byte. I'll try (and post a better description if I fail). =)

ways commented 2 years ago

I posted my changes at https://github.com/ways/meter_reading/blob/master/mqtt_aidon_obis.py

But the aidon_obis.py doesn't match this project, so I'm not sure where it's really from...