jantenhove / P1-Meter-ESP8266

Software for the ESP8266 that sends P1 smart meter data to Domoticz (with CRC checking)
GNU General Public License v3.0
80 stars 38 forks source link

Issues with CRC #7

Closed JanJansen47 closed 6 years ago

JanJansen47 commented 6 years ago

Have connected my 5.0 smart meter to an esp8266 and drop the output in a Google sheet in the cloud. I use your smart meter code to retrieve the data, Initially I used an older version of your code with disabled CRC. As now and then I have misreadings (?) I want your latest code ( without changes except the telegram[MAXLINELENGTH] ) but it's seams that the CRC is not working correct. ( no match at all) I did some tests with simple strings like 123 and this is working. I'm the first one with this issue?

incmve commented 6 years ago

No I am having some issues to and I suspect it has something to do with the buffer. My old telegram

/KFM5KAIFA-METER

1-3:0.2.8(42)
0-0:1.0.0(160303175112W)
0-0:96.1.1(4530303235303030303230303932343134)
1-0:1.8.1(002371.377*kWh)
1-0:1.8.2(002489.293*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(03.135*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00009)
0-0:96.7.9(00007)
1-0:99.97.0(2)(0-0:96.7.19)(150916091547S)(0000000184*s)(000101000001W)(2147483647*s)
1-0:32.32.0(00000)
1-0:32.36.0(00000)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(013*A)
1-0:21.7.0(03.120*kW)
1-0:22.7.0(00.000*kW)
!0DD1

and my new

/KFM5KAIFA-METER

1-3:0.2.8(42)
0-0:1.0.0(180620213548S)
0-0:96.1.1(4530303235303030303230303932343134)
1-0:1.8.1(009205.522*kWh)
1-0:1.8.2(009293.381*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.770*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00010)
0-0:96.7.9(00007)
1-0:99.97.0(3)(0-0:96.7.19)(160715150900S)(0000001253*s)(150916091547S)(0000000184*s)(000101000001W)(2147483647*s)
1-0:32.32.0(00000)
1-0:32.36.0(00000)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(003*A)
1-0:21.7.0(00.776*kW)
1-0:22.7.0(00.000*kW)
!1B12
JanJansen47 commented 6 years ago

SoftwareSerial swSer(12, -1, false, 256); Is my configuration for the software serial. You assume we need to increase this buffer. I'll give it a try tomorrow. Goede avond

JanJansen47 commented 6 years ago

screenshot from 2018-06-20 22-45-12

I would not expect much transmission errors as the connection between the smartmeter and the esp8666 is 20cm max. But now and then there is an issue: unexpected values (mostly 0 in one of the values) in several readings during 10 minutes.

incmve commented 6 years ago

I found my problem with the crc I had to increase https://github.com/jantenhove/P1-Meter-ESP8266/blob/master/P1Meter.ino#L32

#define MAXLINELENGTH 120
JanJansen47 commented 6 years ago

screenshot from 2018-06-20 22-45-12

I would not expect much transmission errors as the connection between the smartmeter and the esp8666 is 20cm max. But now and then there is an issue: unexpected values (mostly 0 in one of the values) in several readings during 10 minutes.

JanJansen47 commented 6 years ago

screenshot from 2018-06-21 12-57-50 Hello Jan,

Thanks for the advice, For my meter I already used 128. Obviously the number of characters of a Sagemcom T210-D is larger and I'm using 256 for the telegram length for now. I forwarded the CRC and the "validCRCFound" to my sheet in the Google Cloud. I did not expect many NOK's! Let's see.