meltaxa / solariot

Leverage your IoT enabled Solar PV Inverter to stream your solar energy usage data to a real time dashboard.
https://solariot.live
MIT License
201 stars 69 forks source link

WiFi vs Ethernet #53

Closed rark-ha closed 2 years ago

rark-ha commented 3 years ago

I had my inverter connected via Wi-Fi until I had time to run an ethernet cable to it. Switched it over to an ethernet connection and iCloudsolar etc continued to work without issue.

But solaroit.py kept reporting 'Modbus connection failed' and 'Failed to scrape inverter, sleeping until next scan' in the log file.

I'd updated the config.py to the ethernet ip address but it didn't work still. I could run a Modbus poll from another machine without any issue.

Also tried;

I turned wifi back on (and ethernet still on), pointed config.py to the wifi ip, and it started working again.

Why the issue with ethernet?

rark-ha commented 3 years ago

I've discovered that I now cannot connect to the modbus. I've tried it from a few different systems but it won't read the input registers (e.g. 5000 + 1000) as it returns illegal address details. The only thing I can pull is the holding registers 4999 + 10 (so I know it's connecting).

From the inverter web interface I can read these input registers from the testing page so I know the address is correct.

Any ideas?

rark-ha commented 3 years ago

This is the error I'm now getting trying to read the input registers.

ERROR:pymodbus.factory:index out of range | stdout ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request

rark-ha commented 2 years ago

The full debug log. I'm at a loss as to why it's stopped working.

DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.20.15', 44201) INFO:root:Connected INFO:root:No MQTT configuration detected INFO:root:Configured InfluxDB Client INFO:root:Configured PVOutput Client DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.20.15', 55641) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.20.15', 38806) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.20.15', 39178) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.20.15', 47456) DEBUG:pymodbus.transaction:Current transaction state - IDLE DEBUG:pymodbus.transaction:Running transaction 1 DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.20.15', 48679) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.20.15', 36205) DEBUG:pymodbus.transaction:SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64 DEBUG:pymodbus.client.sync:New Transaction state 'SENDING' DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' DEBUG:pymodbus.transaction:Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY' DEBUG:pymodbus.transaction:RECV: 0x0 0x1 0x0 0x0 0x0 0x2 0x1 0x84 0x2 DEBUG:pymodbus.framer.socket_framer:Processing: 0x0 0x1 0x0 0x0 0x0 0x2 0x1 0x84 0x2 DEBUG:pymodbus.factory:Factory Response[132] ERROR:pymodbus.factory:index out of range ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/usr/local/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket self._process(callback) File "/usr/local/lib/python3.9/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 WARNING:root:Modbus connection failed WARNING:root:Failed to scrape inverter, sleeping until next scan

meltaxa commented 2 years ago

Try the latest code which addresses the pymodbus version issue.

rark-ha commented 2 years ago

Still get the same error.

bohdan-s commented 2 years ago

Hi, I am getting the same issues. New install of a Sungrow SG7.0RT. I have the modbus map from Sungrow so know I am hitting the right registers. I can read the holding registers OK and run it from the web interface. I have moved from WiFi to LAN and still same issue.

bohdan-s commented 2 years ago

DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64489) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64490) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64491) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64492) DEBUG:pymodbus.transaction:Current transaction state - TRANSACTION_COMPLETE DEBUG:pymodbus.transaction:Running transaction 13 DEBUG:pymodbus.transaction:Clearing current Frame : - 0x0 0xc 0x0 0x0 0x0 0x2 0x1 0x84 0x2 DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64493) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64494) DEBUG:pymodbus.transaction:SEND: 0x0 0xd 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64 DEBUG:pymodbus.client.sync:New Transaction state 'SENDING' DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' DEBUG:pymodbus.transaction:Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY' DEBUG:pymodbus.transaction:RECV: 0x0 0xd 0x0 0x0 0x0 0x2 0x1 0x84 0x2 DEBUG:pymodbus.framer.socket_framer:Processing: 0x0 0xd 0x0 0x0 0x0 0x2 0x1 0x84 0x2 DEBUG:pymodbus.factory:Factory Response[132] ERROR:pymodbus.factory:index out of range ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket self._process(callback) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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 WARNING:root:Modbus connection failed WARNING:root:Failed to scrape inverter, sleeping until next scan DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64520) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64521) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64522) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64523) DEBUG:pymodbus.transaction:Current transaction state - TRANSACTION_COMPLETE DEBUG:pymodbus.transaction:Running transaction 14 DEBUG:pymodbus.transaction:Clearing current Frame : - 0x0 0xd 0x0 0x0 0x0 0x2 0x1 0x84 0x2 DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64524) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('192.168.1.148', 64525) DEBUG:pymodbus.transaction:SEND: 0x0 0xe 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x88 0x0 0x64 DEBUG:pymodbus.client.sync:New Transaction state 'SENDING' DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY' DEBUG:pymodbus.transaction:Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY' DEBUG:pymodbus.transaction:RECV: 0x0 0xe 0x0 0x0 0x0 0x2 0x1 0x84 0x2 DEBUG:pymodbus.framer.socket_framer:Processing: 0x0 0xe 0x0 0x0 0x0 0x2 0x1 0x84 0x2 DEBUG:pymodbus.factory:Factory Response[132] ERROR:pymodbus.factory:index out of range ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py", line 153, in processIncomingPacket self._process(callback) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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 WARNING:root:Modbus connection failed WARNING:root:Failed to scrape inverter, sleeping until next scan

rark-ha commented 2 years ago

I can read the holding registers OK and run it from the web interface. I have moved from WiFi to LAN and still same issue.

This is my exact issue. Perhaps coincidental that it was working and stopped when I went to LAN, but it doesn't matter if I remove LAN now or not. I have the same error log file as you.

bohdan-s commented 2 years ago

Hi, please see #66, I have created a new library SungrowModbusWebClient to pull the modbus via HTTP requests. It's dirty but I have been running it now for a week.