MatterVN / ModbusTCP2MQTT

Sungrow & SMA Solar Inverter addon for Home Assistant using mobusTCP
MIT License
67 stars 50 forks source link

Modbus Error: [Input/Output] [Errno 104] Connection reset by peer #48

Closed cartman10 closed 1 year ago

cartman10 commented 1 year ago

When the add-on is started it receives some data from the WiNet-S and the subsequent connections are reset by peer : 2022-08-23 17:24:21 DEBUG Running transaction 10 2022-08-23 17:24:21 DEBUG SEND: 0x0 0xa 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64 2022-08-23 17:24:21 DEBUG New Transaction state 'SENDING' 2022-08-23 17:24:21 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2022-08-23 17:24:21 DEBUG Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY' 2022-08-23 17:24:21 DEBUG RECV: 0x0 0xa 0x0 0x0 0x0 0xcb 0x1 0x4 0xc8 0x0 0x64 0x0 0x1 0x1 0x4 0x0 0x86 0x0 0x0 0x0 0x47 0x0 0x0 0x1 0x99 0x8 0xbf 0x0 0x0 0x10 0x96 0x0 0x35 0x6 0x43 0x0 0x0 0x0 0x0 0x0 0x0 0x8 0xca 0x0 0x0 0x8 0xf0 0x9 0x0 0x9 0x10 0x0 0x20 0x0 0x20 0x0 0x20 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x8 0xb9 0x0 0x0 0x0 0x0 0x0 0x0 0x3 0xe8 0x1 0xf3 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x32 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0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 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 2022-08-23 17:24:21 DEBUG Factory Response[ReadInputRegistersResponse: 4] 2022-08-23 17:24:21 DEBUG Adding transaction 10 2022-08-23 17:24:21 DEBUG Getting transaction 10 2022-08-23 17:24:21 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2022-08-23 17:24:21 DEBUG Scraping: read, 5100:100 2022-08-23 17:24:21 DEBUG load_registers: read, 5100:100 2022-08-23 17:24:21 DEBUG Current transaction state - TRANSACTION_COMPLETE 2022-08-23 17:24:21 DEBUG Running transaction 11 2022-08-23 17:24:21 DEBUG SEND: 0x0 0xb 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0xec 0x0 0x64 2022-08-23 17:24:21 DEBUG New Transaction state 'SENDING' 2022-08-23 17:24:21 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2022-08-23 17:24:21 DEBUG Transaction failed. ([Errno 104] Connection reset by peer) 2022-08-23 17:24:21 DEBUG Processing: 2022-08-23 17:24:21 DEBUG Getting transaction 11 2022-08-23 17:24:21 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2022-08-23 17:24:21 WARNING Modbus connection failed Modbus connection failed 2022-08-23 17:24:21 DEBUG Modbus Error: [Input/Output] [Errno 104] Connection reset by peer 2022-08-23 17:24:21 DEBUG Scraping: hold, 4999:10 2022-08-23 17:24:21 DEBUG load_registers: hold, 4999:10 2022-08-23 17:24:21 DEBUG Current transaction state - TRANSACTION_COMPLETE 2022-08-23 17:24:21 DEBUG Running transaction 12 2022-08-23 17:24:21 DEBUG SEND: 0x0 0xc 0x0 0x0 0x0 0x6 0x1 0x3 0x13 0x87 0x0 0xa 2022-08-23 17:24:21 DEBUG New Transaction state 'SENDING' 2022-08-23 17:24:21 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2022-08-23 17:24:21 DEBUG Transaction failed. ([Errno 104] Connection reset by peer) 2022-08-23 17:24:21 DEBUG Processing: 2022-08-23 17:24:21 DEBUG Getting transaction 12 2022-08-23 17:24:21 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2022-08-23 17:24:21 WARNING Modbus connection failed Modbus connection failed 2022-08-23 17:24:21 DEBUG Modbus Error: [Input/Output] [Errno 104] Connection reset by peer 2022-08-23 17:24:21 INFO Scraping: 2/3 registers failed to scrape 2022-08-23 17:24:21 INFO Inverter: Successfully scraped in 0.228663 secs 2022-08-23 17:24:21 DEBUG MQTT: Publishing: inverter/SG10RT/registers : {"device_type_code": "SG10RT", "run_state": "OFF", "daily_power_yields": 26.0, "total_power_yields": 134, "total_running_time": 71, "internal_temperature": 40.9, "total_apparent_power": 2239, "phase_a_voltage": 228.8, "total_active_power": 2233, "work_state_1": "Run", "meter_power": 0, "load_power": 2233, "export_to_grid": 0, "import_from_grid": 0} 2022-08-23 17:24:21 DEBUG MQTT: Message 21 Published 2022-08-23 17:24:21 INFO MQTT: Published 2022-08-23 17:24:21 INFO Closing Session: ModbusTcpClient(192.168.178.58:502) 2022-08-23 17:24:21 DEBUG Processing Time: 0.28 secs 2022-08-23 17:24:21 INFO Next scrape in 29 secs 2022-08-23 17:24:51 DEBUG Checking Modbus Connection 2022-08-23 17:24:51 INFO Modbus, Connecting new session 2022-08-23 17:24:51 DEBUG Scraping: read, 5000:100 2022-08-23 17:24:51 DEBUG load_registers: read, 5000:100 2022-08-23 17:24:51 DEBUG Current transaction state - TRANSACTION_COMPLETE 2022-08-23 17:24:51 DEBUG Running transaction 13 2022-08-23 17:24:51 DEBUG SEND: 0x0 0xd 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64 2022-08-23 17:24:51 DEBUG New Transaction state 'SENDING' 2022-08-23 17:24:51 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2022-08-23 17:24:51 DEBUG Transaction failed. ([Errno 104] Connection reset by peer) 2022-08-23 17:24:51 DEBUG Processing: 2022-08-23 17:24:51 DEBUG Getting transaction 13 2022-08-23 17:24:51 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2022-08-23 17:24:51 WARNING Modbus connection failed Modbus connection failed 2022-08-23 17:24:51 DEBUG Modbus Error: [Input/Output] [Errno 104] Connection reset by peer 2022-08-23 17:24:51 DEBUG Scraping: read, 5100:100 2022-08-23 17:24:51 DEBUG load_registers: read, 5100:100 2022-08-23 17:24:51 DEBUG Current transaction state - TRANSACTION_COMPLETE 2022-08-23 17:24:51 DEBUG Running transaction 14 2022-08-23 17:24:51 DEBUG SEND: 0x0 0xe 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0xec 0x0 0x64 2022-08-23 17:24:51 DEBUG New Transaction state 'SENDING' 2022-08-23 17:24:51 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2022-08-23 17:24:51 DEBUG Transaction failed. ([Errno 104] Connection reset by peer) 2022-08-23 17:24:51 DEBUG Processing: 2022-08-23 17:24:51 DEBUG Getting transaction 14 2022-08-23 17:24:51 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2022-08-23 17:24:51 WARNING Modbus connection failed Modbus connection failed 2022-08-23 17:24:51 DEBUG Modbus Error: [Input/Output] [Errno 104] Connection reset by peer 2022-08-23 17:24:51 DEBUG Scraping: hold, 4999:10 2022-08-23 17:24:51 DEBUG load_registers: hold, 4999:10 2022-08-23 17:24:51 DEBUG Current transaction state - TRANSACTION_COMPLETE 2022-08-23 17:24:51 DEBUG Running transaction 15 2022-08-23 17:24:51 DEBUG SEND: 0x0 0xf 0x0 0x0 0x0 0x6 0x1 0x3 0x13 0x87 0x0 0xa 2022-08-23 17:24:51 DEBUG New Transaction state 'SENDING' 2022-08-23 17:24:51 DEBUG Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' 2022-08-23 17:24:51 DEBUG Transaction failed. ([Errno 104] Connection reset by peer) 2022-08-23 17:24:51 DEBUG Processing: 2022-08-23 17:24:51 DEBUG Getting transaction 15 2022-08-23 17:24:51 DEBUG Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 2022-08-23 17:24:51 WARNING Modbus connection failed Modbus connection failed 2022-08-23 17:24:51 DEBUG Modbus Error: [Input/Output] [Errno 104] Connection reset by peer 2022-08-23 17:24:51 INFO Disconnecting: ModbusTcpClient(192.168.178.58:502) 2022-08-23 17:24:51 INFO Disconnecting: None 2022-08-23 17:24:51 WARNING Data collection failed, skipped exporting data. Retying in 30 secs Data collection failed, skipped exporting data. Retying in 30 secs 2022-08-23 17:24:51 DEBUG Processing Time: 0.23 secs 2022-08-23 17:24:51 INFO Next scrape in 29 secs 2022-08-23 17:25:21 DEBUG Checking Modbus Connection 2022-08-23 17:25:21 INFO Modbus client is not connected, attempting to reconnect 2022-08-23 17:25:21 INFO Connection: ModbusTcpClient(192.168.178.58:502)

cartman10 commented 1 year ago

I found some entries in the core log as well : 2022-08-24 06:45:24.267 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'daily_power_yields' when rendering '{{ value_json.daily_power_yields }}' 2022-08-24 06:45:24.269 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'total_active_power' when rendering '{{ value_json.total_active_power }}' 2022-08-24 06:45:24.274 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'load_power' when rendering '{{ value_json.load_power }}' 2022-08-24 06:45:24.278 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'phase_a_voltage' when rendering '{{ value_json.phase_a_voltage }}' 2022-08-24 06:45:24.281 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'meter_power' when rendering '{{ value_json.meter_power }}'

image

Sometimes a few values friom the inverter are shown, mostly not.

cartman10 commented 1 year ago

I was able to resolve the issue by changing a few configuration parameters.