klatremis / esphome-for-deye

Esphome component for Deye 3 phase inverters for Home Assistant
113 stars 30 forks source link

Erratic inputs from Deye 12K repeatedly received #38

Open parkflyer opened 2 months ago

parkflyer commented 2 months ago

I am using this integration now for several month on my Deye 12K inverter and have observed that received values for different entities (sun12k-pv2_power, sun12k-battery_capacity and a lot more, but not all of them) to be completely out of range, e.g. sun12k-pv2_power being set to 30806kW (real maximum should be around 10.000kW). It seems to appear at random and only for a short period of time. During this "condition" some entities seem to be set to fixed values (e.g. "30806" appears on several other entities), maybe depending on data type (integer, float, ...) or units. Deye_PV2_Power Deye_PV2_Power_2

The behavior started to appear on April 23rd, see included picture (peaks = wrong values). The effect seems to get stronger with higher solar radiation / higher values. From the Debug log:

2024-05-01 11:20:26.596 DEBUG (MainThread) [aioesphomeapi.connection] deye-modbus @ 192.168.0.212: Got message of type SensorStateResponse: key: 3933863750
state: 4114 (correct)
... (other entities)
2024-05-01 11:21:17.823 DEBUG (MainThread) [aioesphomeapi.connection] deye-modbus @ 192.168.0.212: Got message of type SensorStateResponse: key: 3933863750
state: 30806 (incorrect)
... (other entities)
2024-05-01 11:36:54.946 DEBUG (MainThread) [aioesphomeapi.connection] deye-modbus @ 192.168.0.212: Got message of type SensorStateResponse: key: 3933863750
state: 3749 (correct)

I have no clue but it somehow looks that with certain values / bit combinations the reception of data is not working correctly. Any ideas?

Thank you, Ewald

parkflyer commented 2 months ago

Additional info: I cannot see these peaks in the HA Solarman integration, which is running in parallel (using the Deye WLAN connection).

luckylinux commented 2 months ago

What is the sample rate you are using on the ESP32 ? Is it the default ~ 15 secojnds ?

Are you using a proper cable, shielding, etc ?

Your RS485 Transceiver is isolated or not ?

parkflyer commented 2 months ago

Hi!

Sample rate should be default (15 sec) - I did not change it and 15 sec match the update interval I see in HA.

I am not using shielded cables, but the connection between inverter and RS485 module is only 50 cm and between module and ESP32 only a few cm). And there were no problems before April 23rd using the same hardware (I've added a third 5kW battery a few days before and could have touched the module and cables, but normally this should have no impact).

About the isloated RS485 transceiver I'm not sure, I think it is not isolated (looks like the one in the esphome-for-deye README).

Today again was very bad: 04-05-_2024_19-51-27

Thanks, Ewald

luckylinux commented 2 months ago

Did you try rebooting the ESP32 ?

I had weird issues happening with log level set to DEBUG, so it could be that after a while some issues pop up. Try setting to INFO.

About your 30806 it's a bit weird. If it was 32767 I would have told you it's probably an integer overflow for a 16-bit SIGNED Integer (16 bit signed is between -32768 and +32767).

Did you try to increase your Stack Size ?

See an example here: https://github.com/luckylinux/esphome-for-deye/blob/main/boards/esp32-s3-wroom-1-n16r8.yaml

I was doing a lot of troubleshooting for a very separate issue (OTA) so the file is not clean at all. But try to implement the part for the option:

- -DCONFIG_ARDUINO_LOOP_STACK_SIZE=32768

It's been running OK for me for approx. 1 Month on an M5Stack Atom S3 Lite with Isolated RS485 Transceiver.

EDIT 1: if you are powering from the CN pins with a 5V Buck Converter, try to use an AC Power Supply. Try a beefy one, 2A or better, to exclude any Power Supply Issue. IIRC I read on these Issues that the CN2 Power wasn't very stable ...

I use a Raspberry Pi 5V/3A PSU to cross-check and troubleshoot, just to exclude any potential other source of issue.

parkflyer commented 1 month ago

Thank you very much for your quick and comprehensive support! I have started with the easy fixes and attached a USB power adapter (battery based) as power supply - hooray, no more spikes! So I reattached the Deye 12V supply again to see if was just the restart - no luck, spikes reappeared. My next attempt was to add a 330uF 35V low-ESR capacitor between +5V and GND on the ESP32 - again, no luck. So I‘m now adding a power outlet next to the inverter and will use a USB PSU to feed the device. Thanks again for your help!

luckylinux commented 1 month ago

No worries.

I'm sure there were many other Issues reported that required some capacitor etc or a different power supply than the CN2 pins (you might want to browse the "Issues" Section including the closed ones if you want to go down that road, I cannot remember if it was on "both" sides of the Buck Converter or only on the Output).

I suspect that the CN2 Power is not so stable / stabilized. So maybe Inverter Load Response coupled with your Buck Converter causes some Power Supply instability.

Or it could also be EMC related.

Otherwise yeah ... Just use an external PSU and be happy :smile:.

You can also do it the other way if it's preferable: I used a 10m long CAT6 Cable so my ESP32 sits in the Control Cabinet, away from the Inverter, and close to a 230VAC Socket.

Steiner606 commented 2 weeks ago

Hi, I've got the same issue. It seems only to appear when the Converter has a high load. It was running since Sebtember last year without any issues. Since a month or so some measurements show the described high values for a very short time. In particular it`s the battery capacity and the PV Power. I'll try to use a separate power supply as well. I hope thats gonna help.