tfyoung / esphome-junctek_kgf

Component for esphome to read status from a Junctek KG-F coulometer/battery monitor via UART
MIT License
27 stars 20 forks source link

Shiftyfix #8

Closed shiftybugger closed 1 year ago

shiftybugger commented 1 year ago

Removed all error handling and replaced with logic in if statements. Commented out calls to verify_checksum() in handle_settings() and handle_status(). I haven't gotten verify_checksum() working and I don't see a big need for it so I'll leave that out of my fix for now. (Unless someone can convince me of its importance, then I'll fix it out of self interest =)

Edit to add: Apologies to tfyoung for so many commits. I'm new to github and didn't realise that all of my changes would be separate commits. I thought they'd be all rolled together at pull time. I'm really sorry for the mess!

tfyoung commented 1 year ago

Thanks for investigating and coming up with a fix! I think it's worth keeping the checksum in place. It's not the best checksum, but it would still hopefully pick up the occasional bit-flip, which is not totally unlikely with serial interfaces.