turbokongen / hass-AMS

Custom component reading AMS through MBus adapter into HomeAssistant
42 stars 10 forks source link

Changed how packets are fetched from the serial buffer. #70

Closed frankiboy1 closed 2 years ago

frankiboy1 commented 2 years ago

Instead of stopping at the first occurrence of 126, check packet size and fetch the correct amount of bytes. Then check that the last byte is actually the FRAME_FLAG.

frankiboy1 commented 2 years ago

I've only tested this fix on a Norwegian Kaifa meter. Looking at the parser for the other meters, it seems that packet size is always encoded in the same first bytes of the packets, so it should work for all meters.

turbokongen commented 2 years ago

This is also confirmed working with norwegian kaifa and kamstrup. Thank you! 💯