psvanstrom / esphome-p1reader

ESPHome custom component for reading P1 data from electricity meters.
MIT License
252 stars 106 forks source link

All CRC checks fail when log level is INFO, but work at log level DEBUG #42

Closed Beaky2000 closed 1 year ago

Beaky2000 commented 2 years ago

I had no problem setting up a D1-mini according to the instructions (except i inverted the signal in the configuration instead of using the transistor) and everything worked right away, so a big thanks for everything!

Except when I changed the log level to INFO instead of DEBUG, all CRC checks would fail. Rebuilt ESPHome with DEBUG and everything works again.

There is a comment in the code about restoring the newline character because it is needed by the CRC calculations. Is that because the logging removes it, but only if DEBUG logging is enabled? That would explain the behavior I am seeing...

Beaky2000 commented 1 year ago

I solved the problem by rewriting most of the code: https://github.com/Beaky2000/esphome-p1mini

Couldn't have done it without having this project to start from though!