ganehag / pyMeterBus

Pure Python implementation of the Meter-Bus (M-Bus EN13757-3) protocol.
BSD 3-Clause "New" or "Revised" License
77 stars 40 forks source link

IndexError: list index out of range #10

Closed kolucciy closed 5 years ago

kolucciy commented 5 years ago

Getting the following errors:

File "/home/.local/lib/python3.7/site-packages/meterbus/telegram_body.py", line 196, in load
    self.version_field = bodyHeader[7]
IndexError: list index out of range

When parsing "68 05 05 68 08 00 78 0f 00 8f 16"

ganehag commented 5 years ago

I will take a look at it.

ganehag commented 5 years ago

pyMeterBus has a problem decoding the seventh byte, 0x78. The reason is quite simple, I can't even find the declaration it in the MBus documentation (m-bus.com). This may very well be part of the new; not at all open and not freely available standard.

I've patched parts of the code and this error should now result in;

 MBusFrameDecodeError("Not a variable data long frame")

As of right now. I can't fix it, as I don't what 0x78 is.

kolucciy commented 5 years ago

Hi @ganehag thanks for your quick reply. This can potentially answer the question of what 0x78 is https://w5.siemens.com/web/cz/cz/corporate/portal/home/produkty_a_sluzby/IBT/mereni_a_regulace/mereni_tepla_a_prutoku/merice_tepla_a_chladu/Documents/TKB3462_V1.0_en.pdf

ganehag commented 5 years ago

Hmm... Looks like it's Variable Data. But without the header. Should be easy enough to handle. I hope... :-)

ganehag commented 5 years ago

Patched in v0.7.13.

Should work, or not crash anymore at least. The parsed_value is '00' for the first (and only) record.