psvanstrom / esphome-p1reader

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

CRC Pass=no after a while #78

Open makkanftw opened 1 year ago

makkanftw commented 1 year ago

Hi! Recently built the P1 reader using the PCB from Naesstrom and using this repo and it works fine for a while but then I start getting CRC PASS = NO and then garbled data and after that nothing. I have S34U18 (Sanxing SX631) / Vattenfall with P1 active and using D1 mini MCU. Any suggestions?

Logs: `[11:52:22][I][crc:281]: Telegram read. CRC: F122 = F122. PASS = YES [11:52:22][D][sensor:093]: 'Cumulative Active Import': Sending state 1626.19897 kWh with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Cumulative Active Export': Sending state 0.00000 kWh with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Cumulative Reactive Import': Sending state 2.60200 kvarh with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Cumulative Reactive Export': Sending state 1235.21204 kvarh with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Active Import': Sending state 0.76800 kW with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Active Export': Sending state 0.00000 kW with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Reactive Import': Sending state 0.00000 kvar with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Reactive Export': Sending state 0.49600 kvar with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Active Import Phase 1': Sending state 0.35000 kW with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Active Export Phase 1': Sending state 0.00000 kW with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Active Import Phase 2': Sending state 0.26900 kW with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Active Export Phase 2': Sending state 0.00000 kW with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Active Import Phase 3': Sending state 0.14800 kW with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Active Export Phase 3': Sending state 0.00000 kW with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Reactive Import Phase 1': Sending state 0.00000 kvar with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Reactive Export Phase 1': Sending state 0.11900 kvar with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Reactive Import Phase 2': Sending state 0.00000 kvar with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Reactive Export Phase 2': Sending state 0.14100 kvar with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Reactive Import Phase 3': Sending state 0.00000 kvar with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Momentary Reactive Export Phase 3': Sending state 0.23400 kvar with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Voltage Phase 1': Sending state 235.30000 V with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Voltage Phase 2': Sending state 236.39999 V with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Voltage Phase 3': Sending state 235.70000 V with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Current Phase 1': Sending state 1.60000 A with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Current Phase 2': Sending state 1.30000 A with 3 decimals of accuracy [11:52:22][D][sensor:093]: 'Current Phase 3': Sending state 1.20000 A with 3 decimals of accuracy [11:52:22][W][component:204]: Component took a long time for an operation (0.12 s). [11:52:22][W][component:205]: Components should block for at most 20-30ms.

[11:52:27][D][data:270]: 1-0:3.8.0(000002.602*kvarh 

[11:52:27][D][data:270]:  :3.7.0(0000.

[11:52:27][D][data:270]: [11:52:27][D][data:270]: [11:52:27][D][data:270]: [11:52:27][D][data:270]: [11:52:27][D][data:270]: [11:52:27][D][data:270]: [11:52:27][D][data:270]: [11:52:27][D][data:270]: I\x8es \xbb\xb0\xff\xfe{\xed\xff\x9b\xbf\xfb\xb0

[11:52:27][D][data:270]: 4n\x96\xea\xfc\xff~\xff\xbf\xbb\xee\xbf\xdd\xfb\xbf\xf7 \xff\xff\x83\xf3\xfb\xddò\xcc\xd9\xff\xff\xff\xff\xf7\xb7\xff\xf7\x97\xbf\xf7\xf7\xffw\xbf\xf7\xbf\xff\xbf\xf7\xff\xf7\xb7\xbb

[11:52:27][D][data:270]:

[11:52:27][D][data:270]: [11:52:27][D][data:270]: @ @\xd8

[11:52:27][D][data:270]: [11:52:27][D][data:270]: [11:52:27][D][data:270]:

[11:52:27][D][data:270]:

[11:52:28][D][data:270]: w\xf3\xfe\xdc\xdfn \x94

[11:52:28][D][data:270]: [11:52:28][D][data:270]: [11:52:28][D][data:270]: @ @

[11:52:28][D][data:270]: [11:52:28][D][data:270]: \x82D\xd3V@ N0 [11:52:28][D][data:270]: [11:52:28][D][data:270]: [11:52:28][D][data:270]: \x80D;\x80\xc0V\xc9\xf9\xbf\x95\x82R@ \xfc\xc3\xee

[11:52:28][D][data:270]:

[11:52:28][D][data:270]:

\xbf\xae\xa3 [11:52:28][D][data:270]:

\xb66r\xa8\xb1\xb7\xb7Ȁ\x80

[11:52:28][D][data:270]:

[11:52:28][D][data:270]: [11:52:28][D][data:270]:

[11:52:28][D][data:270]:

[11:52:28][D][data:270]:

[11:52:28][D][data:270]:

[11:52:28][D][data:270]:

[11:52:28][D][data:270]:

[11:52:29][D][data:270]: [11:52:29][D][data:270]: [11:52:29][D][data:270]: [11:52:29][D][data:270]:

[11:52:29][D][data:270]: [11:52:29][D][data:270]:

[11:52:29][D][data:270]: [11:52:29][D][data:270]:

[11:52:29][D][data:270]:
[11:52:29][D][data:270]: [11:52:29][D][data:270]:

[11:52:29][D][data:270]: [11:52:30][D][data:270]: [11:52:30][D][data:270]:

[11:52:30][D][data:270]: [11:52:30][D][data:270]: [11:52:30][D][data:270]: [11:52:30][D][data:270]: \x96#\xf7\xbd3>\xefD\xf8\xff7\xbf\xdf @

[11:52:30][D][data:270]:

[11:52:31][D][data:270]:

[11:52:31][D][data:270]: [11:52:31][D][data:270]: [11:52:31][D][data:270]:

[11:52:31][D][data:270]: [11:52:31][D][data:270]:

[11:52:31][I][crc:281]: Telegram read. CRC: 107C = 0000. PASS = NO

[11:52:31][D][data:270]: [11:52:31][D][data:270]:

[11:52:31][D][data:270]:

[11:52:31][D][data:270]: \xb6\xb5u\x97\xab\xb5\xb3\xeeٹw$\xb4/\xfb\xa5 \x93\xddw'л6\xb7\x80aw6\x8d\x807w "

[11:52:31][D][data:270]:

[11:52:31][D][data:270]: \x80 r\xa9 [11:52:31][D][data:270]: [11:52:31][D][data:270]: 

}m\x9f [11:52:31][D][data:270]: [11:52:31][D][data:270]: [11:52:31][D][data:270]: 0Tݓv?\xed\x9a^\xf6\xfdݐQ\xbb\xb7\xfbw\x97s\xfd\xff\xf0\xff \x93\xe3\xff\xff\xd07\xb77\xbb7\xbf\xff

[11:52:31][D][data:270]: \xa3\xf6'\xfd\xb3;,\xff" w\xff\xa6\xa5~λ2$\xb3;\xff\x95\x83\xff\xfe\xff\xfb\xf7\xf7\xff\xc0\xefj\xaf槳\xb6\xbf\xb7\xd7\xf7\xb7\xb7\xb7\xb7\xb7\xbb7w\xf7\xb7

[11:52:31][D][data:270]: [11:52:31][D][data:270]:

[11:52:31][D][data:270]: \x91 @e`\x81HQ\xcd$\xc4 %\xfcFHؠd\xfd\xff\xff\xff [11:52:31][D][data:270]:

[11:52:31][D][data:270]: [11:52:31][D][data:270]:

[11:52:31][D][data:270]:

[11:52:31][D][data:270]:

[11:52:31][D][data:270]: [11:52:31][D][data:270]: P \x80 [11:52:31][D][data:270]: [11:52:31][D][data:270]: [11:52:31][D][data:270]:

[11:52:31][D][data:270]:

[11:52:31][D][data:270]: 1V\xe7\x93:r\xf6o\x99\xffD3r$S\x96\x858w$仵Gv ?F\x977\xbf\xb7\xb7\xb7\xb7\xb7\xff\xa0\x922jH٢7\xb777\xf3\xbf\xff

\xbb\xf3\xff\xf7\xf7\xb7\xf7\xb7\xbf\xbf

[11:52:31][D][data:270]: D\x981'@\x82`\x84"&\x927 \x9d&i\x815d \xee |\x90wf

[11:52:31][D][data:270]: 5\xd86'`\x83@dG \xd0\xe0\x80\xc7\xf7w\x9c\xd2\xfbTR\xa0(

[11:52:32][D][data:270]:

[11:52:32][D][data:270]:

[11:52:32][D][data:270]:

T`

[11:52:32][D][data:270]: [11:52:32][D][data:270]:

[11:52:32][D][data:270]:

[11:52:32][D][data:270]: \x90 %H\x8c\x84\x81 [11:52:32][D][data:270]:

[11:52:32][D][data:270]:

[11:52:32][D][data:270]:

[11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:32][D][data:270]: [11:52:33][D][data:270]: [11:52:33][W][component:204]: Component took a long time for an operation (6.28 s). [11:52:33][W][component:205]: Components should block for at most 20-30ms.

[11:52:37][I][crc:281]: Telegram read. CRC: C3DB = AF3B. PASS = NO [11:52:37][W][component:204]: Component took a long time for an operation (1.63 s). [11:52:37][W][component:205]: Components should block for at most 20-30ms. [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:42][D][data:270]: [11:52:43][D][data:270]: [11:52:43][W][component:204]: Component took a long time for an operation (1.40 s). [11:52:43][W][component:205]: Components should block for at most 20-30ms. [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:47][D][data:270]: [11:52:48][D][data:270]: [11:52:48][W][component:204]: Component took a long time for an operation (1.12 s). [11:52:48][W][component:205]: Components should block for at most 20-30ms. [11:52:52][D][data:270]: [11:52:52][W][component:204]: Component took a long time for an operation (2.21 s). [11:52:52][W][component:205]: Components should block for at most 20-30ms. [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:52][D][data:270]: [11:52:53][D][data:270]: [11:52:53][W][component:204]: Component took a long time for an operation (1.12 s). [11:52:53][W][component:205]: Components should block for at most 20-30ms. [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]: [11:52:57][D][data:270]:

makkanftw commented 1 year ago

I have tried this suggestion with no change: https://github.com/psvanstrom/esphome-p1reader/issues/36#issuecomment-1319105424

Also tried different cable and different D1 Mini, same behavior.

Beaky2000 commented 1 year ago

I believe that the S34U18 (Sanxing SX631) sometimes and for unknown reasons take very long (several seconds) to transmit an update, and it seems that this reader does not work well in those cases.

It looks like there is a pull-request that will adress this so it could be that your problem will be fixed when/if that PR is approved.

You could also try my fork of this project, which I believe works well with the S34U18: https://github.com/Beaky2000/esphome-p1mini

makkanftw commented 1 year ago

@Beaky2000 I found your fork after giving up troubleshooting this one and has been working perfect for a couple of days now. Thanks!