fliphess / esp8266_p1meter

dsmr 4.2 P1 meter to mqtt using esp8266 nodemcu
GNU General Public License v3.0
69 stars 114 forks source link

Fix compatibility with latest SoftwareSerial and DSMR 4.2.2 #4

Closed Roosted7 closed 4 years ago

Roosted7 commented 4 years ago

Thanks for your cool project! After changing two small things, I've now got my energy in HA :+1:

Firstly, the current version of te SoftwareSerial library doesn't require (nor accept) an buffersize in the initialization of the object. Simply removing this argument fixes compilation.

Secondly, my Kaifa MA105C (DSMR 4.2.2) spits out quite bit more than the 64 char buffer could hold which caused the CRC check to fail. By increasing the buffersize to 1024 the line is being read in correctly and the CRC passes. 512 might also just about have been enough, but since this sketch isn't too complicated there is a lot of free memory left anyway. (You could now also update the README and such to reflect 4.2.2 compatibility, but I'll leave that up to you - 4.2.2 is a subversion of 4.2)

fliphess commented 4 years ago

Hey @Roosted7 ! Thanks a lot for this fix, I will merge it for now, as it looks the right way to fix. (I can't test it for now, but I'm working on that)

proddy commented 4 years ago

@Roosted7 thanks for this. I was just about to wire up a circuit to my MA105C and use this software