ptarcher / pvstats

PVStats is a tool used to connect to your inverter using Modbus TCP, scan for various power figures, and then upload the data to various report services.
Apache License 2.0
14 stars 11 forks source link

Add support for Sungrow SH5k-20 #4

Open tjhowse opened 4 years ago

tjhowse commented 4 years ago

I've made a fair few modifications to how the interface works. I've added the registers that the SH5k-20 holds, as well as added a type key to the register map per register, to allow for translation to signed values before publishing to MQTT.

I slightly reworked how modbus reconnects are handled.

I'm still not entirely happy with this interface. Sometimes the inverter stops responding to modbus requests for a while. I'm not sure if this is a timing issue, or whether the inverter doesn't properly implement modbus, or what. It's a little annoying.

In any case, this is a better starting point for someone wanting to get data from an SH5k-20 using pvstats than not having it at all.

I also stored the registers using integer keys, not strings, since they sort correctly. When adding registers in the 13000 range they sorted to before the registers in the 5000 range, causing difficulties.

tjhowse commented 4 years ago

I have drastically improved the performance of this interface by hard-wiring an ethernet connection to the inverter rather than using the wifi dongle. Modbus communication failures have completely gone away. It's quite likely the modbus re-connection change I made in this branch are unnecessary.

tjhowse commented 4 years ago

@ptarcher Ping! Are you alive?