mkaiser / Sungrow-SHx-Inverter-Modbus-Home-Assistant

Sungrow SH Integration for Home Assistant for SH3K6, SH4K6, SH5K-20, SH5K-V13, SH3K6-30, SH4K6-30, SH5K-30, SH3.RS, SH3.6RS, SH4.0RS, SH5.0RS, SH6.0RS, SH5.0RT, SH6.0RT, SH8.0RT, SH10RT, SH5.0RT-20, SH6.0RT-20, SH8.0RT-20, SH10RT-20, SH5.0RT-V112, SH6.0RT-V112, SH8.0RT-V112, SH10RT-V112, SH5.0RT-V122, SH6.0RT-V122, SH8.0RT-V122, SH10RT-V122, SH4.6R
310 stars 80 forks source link

LAN connection with Winet-S #94

Closed scraja69 closed 10 months ago

scraja69 commented 1 year ago

I got Modbus LAN connection details from Sungrow. I was able to get Modbus data from following instructions given below from my SG15RT inverter. I used LAN port in Winet-S.

The Procedure for Setting up Winet . [TD_202102_iSolarCloud_WiNet Dongle Quick Guide_V1.0.pdf](https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/files/11209230/TD_202102_iSolarCloud_WiNet.Dongle.Quick.Guide_V1.0.pdf) Modbus Connection.pdf IMG20230412190649

lassej01 commented 1 year ago

Hi!. good for you. Still there are many users here who have had problems with some or all values from Modbus using the method with connection to modbus through the dongle.

mkaiser commented 1 year ago

Good to know. Are all sensors read and working well?

Most issues were battery-related (not applicable in your case) and some sensors like grid frequency (off by factor 10)

Can you tell us the installed firmware version?

I don't want to believe yet, that sungrow is finally fixing the winet stuff ;)

scraja69 commented 1 year ago

Hi, Thank you for your great project. I have not tested fully. I will test and let you know. Here is the log from ModbusTCP2MQTT

Regards

Seethaka

pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/usr/lib/python3.10/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket self._process(callback) File "/usr/lib/python3.10/site-packages/pymodbus/framer/socket_framer.py", line 175, in _process raise ModbusIOException("Unable to decode request") pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request 2023-04-12 22:26:51 WARNING Modbus connection failed Modbus connection failed 2023-04-12 22:26:51 DEBUG Modbus Error: [Input/Output] Unable to decode request 2023-04-12 22:26:51 DEBUG Scraping: hold, 4999:10 2023-04-12 22:26:51 DEBUG load_registers: hold, 4999:10 2023-04-12 22:26:51 DEBUG Connection to Modbus server established. Socket ('172.30.33.19', 48687) 2023-04-12 22:26:51 DEBUG Current transaction state - TRANSACTION_COMPLETE 2023-04-12 22:26:51 DEBUG Running transaction 51 2023-04-12 22:26:51 DEBUG Clearing current Frame : - 0x0 0x32 0x0 0x0 0x0 0x2 0x1 0x84 0x2 2023-04-12 22:26:51 DEBUG SEND: 0x0 0x33 0x0 0x0 0x0 0x6 0x1 0x3 0x13 0x87 0x0 0xa 2023-04-12 22:26:51 DEBUG New Transaction state 'SENDING' 2023-04-12 22:26:51 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2023-04-12 22:26:51 DEBUG Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY' 2023-04-12 22:26:51 DEBUG RECV: 0x0 0x33 0x0 0x0 0x0 0x17 0x1 0x3 0x14 0x7 0xe7 0x0 0x4 0x0 0xc 0x0 0x16 0x0 0x1a 0x0 0x29 0x0 0xcf 0x0 0xaa 0x3 0xe8 0xff 0xff 2023-04-12 22:26:51 DEBUG Processing: 0x0 0x33 0x0 0x0 0x0 0x17 0x1 0x3 0x14 0x7 0xe7 0x0 0x4 0x0 0xc 0x0 0x16 0x0 0x1a 0x0 0x29 0x0 0xcf 0x0 0xaa 0x3 0xe8 0xff 0xff 2023-04-12 22:26:51 DEBUG Factory Response[ReadHoldingRegistersResponse: 3] 2023-04-12 22:26:51 DEBUG Adding transaction 51 2023-04-12 22:26:51 DEBUG Getting transaction 51 2023-04-12 22:26:51 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2023-04-12 22:26:51 DEBUG Scraping: hold, 5009:10 2023-04-12 22:26:51 DEBUG load_registers: hold, 5009:10 2023-04-12 22:26:51 DEBUG Current transaction state - TRANSACTION_COMPLETE 2023-04-12 22:26:51 DEBUG Running transaction 52 2023-04-12 22:26:51 DEBUG SEND: 0x0 0x34 0x0 0x0 0x0 0x6 0x1 0x3 0x13 0x91 0x0 0xa 2023-04-12 22:26:51 DEBUG New Transaction state 'SENDING' 2023-04-12 22:26:51 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2023-04-12 22:26:51 DEBUG Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY' 2023-04-12 22:26:51 DEBUG RECV: 0x0 0x34 0x0 0x0 0x0 0x17 0x1 0x3 0x14 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 2023-04-12 22:26:51 DEBUG Processing: 0x0 0x34 0x0 0x0 0x0 0x17 0x1 0x3 0x14 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 2023-04-12 22:26:51 DEBUG Factory Response[ReadHoldingRegistersResponse: 3] 2023-04-12 22:26:51 DEBUG Adding transaction 52 2023-04-12 22:26:51 DEBUG Getting transaction 52 2023-04-12 22:26:51 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2023-04-12 22:26:51 DEBUG Scraping: hold, 5034:10 2023-04-12 22:26:51 DEBUG load_registers: hold, 5034:10 2023-04-12 22:26:51 DEBUG Current transaction state - TRANSACTION_COMPLETE 2023-04-12 22:26:51 DEBUG Running transaction 53 2023-04-12 22:26:51 DEBUG SEND: 0x0 0x35 0x0 0x0 0x0 0x6 0x1 0x3 0x13 0xaa 0x0 0xa 2023-04-12 22:26:51 DEBUG New Transaction state 'SENDING' 2023-04-12 22:26:51 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2023-04-12 22:26:52 DEBUG Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY' 2023-04-12 22:26:52 DEBUG RECV: 0x0 0x35 0x0 0x0 0x0 0x17 0x1 0x3 0x14 0x0 0x55 0x0 0xa4 0xff 0xff 0xff 0xff 0x0 0x96 0xff 0xff 0x0 0x55 0xff 0xff 0xff 0xff 0xff 0xff 2023-04-12 22:26:52 DEBUG Processing: 0x0 0x35 0x0 0x0 0x0 0x17 0x1 0x3 0x14 0x0 0x55 0x0 0xa4 0xff 0xff 0xff 0xff 0x0 0x96 0xff 0xff 0x0 0x55 0xff 0xff 0xff 0xff 0xff 0xff 2023-04-12 22:26:52 DEBUG Factory Response[ReadHoldingRegistersResponse: 3] 2023-04-12 22:26:52 DEBUG Adding transaction 53 2023-04-12 22:26:52 DEBUG Getting transaction 53 2023-04-12 22:26:52 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2023-04-12 22:26:52 DEBUG Scraping: hold, 13000:100 2023-04-12 22:26:52 DEBUG load_registers: hold, 13000:100 2023-04-12 22:26:52 DEBUG Current transaction state - TRANSACTION_COMPLETE 2023-04-12 22:26:52 DEBUG Running transaction 54 2023-04-12 22:26:52 DEBUG SEND: 0x0 0x36 0x0 0x0 0x0 0x6 0x1 0x3 0x32 0xc8 0x0 0x64 2023-04-12 22:26:52 DEBUG New Transaction state 'SENDING' 2023-04-12 22:26:52 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2023-04-12 22:26:52 DEBUG Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY' 2023-04-12 22:26:52 DEBUG RECV: 0x0 0x36 0x0 0x0 0x0 0x2 0x1 0x83 0x4 2023-04-12 22:26:52 DEBUG Processing: 0x0 0x36 0x0 0x0 0x0 0x2 0x1 0x83 0x4 2023-04-12 22:26:52 DEBUG Factory Response[131] 2023-04-12 22:26:52 ERROR index out of range index out of range 2023-04-12 22:26:52 ERROR Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/usr/lib/python3.10/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket self._process(callback) File "/usr/lib/python3.10/site-packages/pymodbus/framer/socket_framer.py", line 175, in _process raise ModbusIOException("Unable to decode request") pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/usr/lib/python3.10/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket self._process(callback) File "/usr/lib/python3.10/site-packages/pymodbus/framer/socket_framer.py", line 175, in _process raise ModbusIOException("Unable to decode request") pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request 2023-04-12 22:26:52 WARNING Modbus connection failed Modbus connection failed 2023-04-12 22:26:52 DEBUG Modbus Error: [Input/Output] Unable to decode request 2023-04-12 22:26:52 INFO Scraping: 9/18 registers failed to scrape 2023-04-12 22:26:52 DEBUG Using Inverter Time: 2023-4-12 22:26:41 2023-04-12 22:26:52 INFO Inverter: Successfully scraped in 0.726488 secs 2023-04-12 22:26:52 DEBUG MQTT: Publishing: inverter/sg15rt/registers : {"device_type_code": "sg15rt", "run_state": "ON", "protocol_number": 1095971072, "protocol_version": 16849152, "arm_software_version": 19523, "dsp_software_version": 19780, "serial_number": 16690, "nominal_active_power": 15.0, "output_type": "3P4L", "daily_power_yields": 65.2, "total_power_yields": 17808.8, "total_running_time": 3800, "internal_temperature": 43.8, "total_apparent_power": 0, "mppt_1_voltage": 0.0, "mppt_1_current": 0.0, "mppt_2_voltage": 0.0, "mppt_2_current": 0.0, "mppt_3_voltage": 0.0, "mppt_3_current": 0.0, "total_dc_power": 0, "phase_a_voltage": 0.0, "phase_b_voltage": 0.0, "phase_c_voltage": 0.0, "phase_a_current": 0.0, "phase_b_current": 0.0, "phase_c_current": 0.0, "total_active_power": 0, "total_reactive_power": 0, "power_factor": 0.0, "grid_frequency": 0.0, "work_state_1": "Standby", "alarm_code_1": 0, "nominal_reactive_power": 0.0, "array_insulation_resistance": 3154, "active_power_regulation_setpoint": 15000, "reactive_power_regulation_setpoint": 0, "work_state_2": "Run", "meter_power": 0, "meter_a_phase_power": 0, "meter_b_phase_power": 0, "meter_c_phase_power": 0, "load_power": 0, "daily_export_energy": 0.0, "total_export_energy": 0.0, "daily_import_energy": 0.0, "total_import_energy": 0.0, "daily_direct_energy_consumption": 0.0, "total_direct_energy_consumption": 0.0, "daily_running_time": 687, "mppt_4_voltage": 0.0, "mppt_4_current": 0.0, "mppt_5_voltage": 0.0, "mppt_5_current": 0.0, "mppt_6_voltage": 0.0, "mppt_6_current": 0.0, "mppt_7_voltage": 0.0, "mppt_7_current": 0.0, "mppt_8_voltage": 0.0, "mppt_8_current": 0.0, "monthly_power_yields": 572.2, "mppt_9_voltage": 0.0, "mppt_9_current": 0.0, "mppt_10_voltage": 0.0, "mppt_10_current": 0.0, "mppt_11_voltage": 0.0, "mppt_11_current": 0.0, "mppt_12_voltage": 0.0, "mppt_12_current": 0.0, "negative_voltage_to_the_ground": 0.0, "bus_voltage": 0.0, "pid_work_state": 0, "pid_alarm_code": 0, "export_power": 0, "power_meter": 0, "export_limit_min": 0, "export_limit_max": 15000, "bdc_rated_power": 0, "bms_max_charging_current": 0, "bms_max_discharging_current": 0, "string_1_current": 0.0, "string_2_current": 0.0, "string_3_current": 0.0, "string_4_current": 0.0, "string_5_current": 0.0, "string_6_current": 0.0, "string_7_current": 0.0, "string_8_current": 0.0, "string_9_current": 0.0, "string_10_current": 0.0, "string_11_current": 0.0, "string_12_current": 0.0, "string_13_current": 0.0, "string_14_current": 0.0, "string_15_current": 0.0, "string_16_current": 0.0, "string_17_current": 0.0, "string_18_current": 0.0, "string_19_current": 0.0, "string_20_current": 0.0, "string_21_current": 0.0, "string_22_current": 0.0, "string_23_current": 0.0, "string_24_current": 0.0, "start_stop": "Start", "power_limitation_switch": "Enable", "power_limitation_setting": 100.0, "export_power_limitation": 0, "export_power_limitation_value": 0, "current_transformer_output_current": 0, "current_transformer_range": 0, "current_transformer": 0, "export_power_limitation_percentage": 0.0, "installed_pv_power": 0.0, "power_factor_setting": 0.0, "night_svg_switch": "Disable", "reactive_power_adjustment_mode": "Enable Q(U)", "reactive_power_percentage_setting": 0.0, "power_limitation_adjustment": 15.0, "reactive_power_adjustment": 0.0, "pid_recovery": "Disable", "anti_pid": 0, "fullday_pid_suppression": 0, "export_to_grid": 0, "import_from_grid": 0, "timestamp": "2023-4-12 22:26:41"} 2023-04-12 22:26:52 DEBUG MQTT: Message 24 Published 2023-04-12 22:26:52 INFO MQTT: Published 2023-04-12 22:26:52 INFO Closing Session: ModbusTcpClient(192.168.1.145:502) 2023-04-12 22:26:52 DEBUG Processing Time: 0.74 secs 2023-04-12 22:26:52 INFO Next scrape in 89 secs

On Wed, Apr 12, 2023 at 9:44 PM mkaiser @.***> wrote:

Good to know. Are all sensors read and working well?

Most issues were battery-related (not applicable in your case) and some sensors like grid frequency (off by factor 10)

Can you tell us the installed firmware version?

I don't want to believe yet, that sungrow is finally fixing the winet stuff ;)

— Reply to this email directly, view it on GitHub https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/issues/94#issuecomment-1505126877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKF32G7D5VNCEINC5EIU5UTXA2ISRANCNFSM6AAAAAAW3MVO5Q . You are receiving this because you authored the thread.Message ID: <mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/issues/94/1505126877@ github.com>

-- Regards. S.C Rajapakse

mkaiser commented 1 year ago

I am wondering why there is some MQTT involved as this integration has nothing do with MQTT confused

scraja69 commented 1 year ago

Hi, I have provided you the log of addon- ModbusTCP2MQTT by https://github.com/MatterVN/ModbusTCP2MQTT to show modbus registers received. I have given below screenshots of your dashboard. Strangely Some of registers are not visible from your dash board .Ex Inverter phase current A, Inverter phase current B, Inverter phase current C but they are visible in ModbusTCP2MQTT ? screenshots.docx Modbustcp2mqtt.docx

dylan09 commented 1 year ago

Please change to the internal LAN Port. And check if all registers have valid values. It seems that the WiNet S doesn`t provide all modbus registers. Even in the latest firmware version. There are some posts and information in photovoltaikforum.de

KLucky13 commented 1 year ago

I'm also struggling to find out the best way forward at this point. I also have 2 inverters using the Winet-S dongle. I'm currently using this integration: https://github.com/MickMake/GoSungrow

But all data has a 5 minute update interval which makes it useless for most of the automations I had in mind..

tjhowse commented 1 year ago

I am running a Sungrow SH5k-20 and I had issues with the modbus connection dropping regularly until I added a firewall rule in my router that blocks internet access to the inverter. This improved the connection, but it still drops occasionally. I suspect the internal modbusRTU to modbusTCP interface inside the inverter/winet dongle can only gracefully handle a single concurrent TCP connection. If Sungrow's cloud stuff is talking to the inverter this might cause issues.