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
204 stars 69 forks source link

WARNING:root:Failed to scrape inverter, sleeping until next scan #99

Open shannonpasto opened 1 year ago

shannonpasto commented 1 year ago

Hi.

I've started seeing the following error after upgrading the repo.

INFO:root:Loaded config sungrow-sg5kd INFO:root:Creating SungrowModbusTcpClient INFO:root:Connecting DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 40441) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 48495) INFO:root:Connected INFO:root:No MQTT configuration detected INFO:root:No Prometheus configuration detected INFO:root:No InfluxDB configuration detected INFO:root:Configured PVOutput Client DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 59731) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 44457) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 33161) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 60073) DEBUG:pymodbus.transaction:Current transaction state - IDLE DEBUG:pymodbus.transaction:Running transaction 1 DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 43245) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 46709) 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:Transaction failed. ([Errno 104] Connection reset by peer) DEBUG:pymodbus.framer.socket_framer:Processing: DEBUG:pymodbus.transaction:Getting transaction 1 DEBUG:pymodbus.transaction:Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE' 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 ('172.16.100.1', 48387) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 36045) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 50981) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 36889) DEBUG:pymodbus.transaction:Current transaction state - TRANSACTION_COMPLETE DEBUG:pymodbus.transaction:Running transaction 2 DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 58809) DEBUG:pymodbus.client.sync:Connection to Modbus server established. Socket ('172.16.100.1', 55761) DEBUG:pymodbus.transaction:SEND: 0x0 0x2 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 DEBUG:pymodbus.framer.socket_framer:Processing: 0x0 DEBUG:pymodbus.factory:Factory Response[0] ERROR:pymodbus.factory:Unable to decode response Modbus Error: Unknown response 0 ERROR:pymodbus.transaction:Modbus Error: [Input/Output] Unable to decode request Traceback (most recent call last): File "/usr/local/.venv/lib/python3.11/site-packages/pymodbus/transaction.py", line 208, in execute self.client.framer.processIncomingPacket(response, File "/usr/local/.venv/lib/python3.11/site-packages/pymodbus/framer/socket_framer.py", line 165, in processIncomingPacket self._process(callback, error=True) File "/usr/local/.venv/lib/python3.11/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 ^CTraceback (most recent call last): File "/root/solariot/./solariot.py", line 612, in time.sleep(config.scan_interval)

I can confirm that the inverter is available...

root@debone:~/solariot# telnet 172.16.100.77 502 Trying 172.16.100.77... Connected to 172.16.100.77. Escape character is '^]'.

I suspect this has something to do with the version of SungrowModbusTcpClient but I am unable to downgrade due to issues with pycrypto.

I'm running this on Debian 12

Any ideas what might be causing this?

Thanks

michael-robbins commented 9 months ago

Sorry been ages since I've checked this repo, but what model do you have, does it always happen or just sometimes?

If you're running this in docker you can clone the repo, tweak the versions then:

docker build -t myimage:latest .
docker run -it --rm --name solariot -v myconfig.py:/config/myconfig.py myimage:latest

Something like the above, and that'll let you quickly iterate on versions/code/etc to try debug.

I've got that inverter model (based on the sg5kd in the logs) as well and can't recall many issues, is your scan interval really low? (like 1-5 seconds), could you back it off to like 30s/etc?