mvandersteen / sungrowinverter Goto Github PK
View Code? Open in Web Editor NEWAllows to pull data from a Sungrow residential inverter via Modbus TCP
License: Other
Allows to pull data from a Sungrow residential inverter via Modbus TCP
License: Other
Changing E03 to E0F in inverter.py makes it work a bit better but something happens:
Running test.py with debug gives this:
http://adent.chroma.se/output.txt
Best regards
Mikael
Hi and thanks for your impressive work!
I'm about to receive a SG15RT string inverter myself in a few weeks. Can you confirm your script works with it? I know you listed it as supported, but I read elsewhere that Modbus TCP does currently not work on string inverters, only on the hybrid ones. Thank you.
Tried installing on python 3.10.5. This failed due to:
This fixed it for me:
pip install pyserial-asyncio
pip install pymodbus==2.4.0
It would probably best to update requirements.txt to list the missing package and pin the pymodbus package to the desired older version.
I think I'm seeing a division by zero error from Line 149 of Hybrid.py early in the day before there's been any generation. As eval() only takes simple expressions a fix may be to add a small quantity to daily_pv_generation, e.g. 0.001
Hello there, has anyone tried running both the Modbus RTU & Modbus TCP from Sungrow's RS-485 & Ethernet port respectively, simultaneously?
Will it interfere with each other?
My SunGrow SG2.5RS-S inverter times out on 'self._send(GET_KEY)'. After (the default 60s) timeout the communication proceeds without encryption and returns valid values. When commenting out 'self._send(GET_KEY)' the communication completes very quickly, without timeout.
I think this problem affects all SGxxRS models (type codes 0x2600-0x2607) and possibly others.
A possible (very ugly) workaround is to decrease the timeout value, but I do not really want to do this.
@jarod1990-Developper: Could you please confirm if you have the same timeout problem with your SG2.0RS-S inverter?
@mvandersteen: Please look into the problem and provide a solution! Thanks!
I would like to get data out of my inverter but I seem unable to import the SungrowInverter library.
pip3 successfully installed both SungrowModbusTcpClient-0.1.6 and SungrowInverter-0.1.7 but when I try to import the module I get a TypeError that I am unable to figure out the reason for.
`PI:~# python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from sungrowinverter import SungrowInverter
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.7/dist-packages/sungrowinverter/init.py", line 4, in
from sungrowinverter.SungrowInverter import SungrowInverter
File "/usr/local/lib/python3.7/dist-packages/sungrowinverter/SungrowInverter.py", line 16, in
from sungrowinverter.configs.inverter import (
File "/usr/local/lib/python3.7/dist-packages/sungrowinverter/configs/inverter.py", line 21, in
ModBusRegister(5001, "nominal_output_power", "U16", 0.1, KILO_WATT),
TypeError: 'type' object is not subscriptable
`
If I loop the test.py file with 10 seconds of sleep after each cycle 4 out of 5 times I get the error:
"pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.10.28:502): Connection unexpectedly closed 3.814697265625e-05 seconds into read of 8 bytes without response from slave before it closed connection"
and the 5th time it reads the data perfect.
python version 3.9.2
pymodbus version 3.4.1
code test.py file:
_#!/usr/local/bin/python3
import asyncio
import logging
import time
from sungrowinverter import SungrowInverter
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
# Change IP Address (192.168.4.2) to suit your inverter
client = SungrowInverter("192.168.10.28", timeout=5)
while True:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
result = loop.run_until_complete(client.async_update())
#Get a list data returned from the inverter.
if result:
print(client.data)
else:
print("Could not connect to inverter")
time.sleep(10)_
Has anyone encountered this issue?
Greetings
I have a Sungrow Device Model: SG5K-D with a Wifi V31 dongle on it. When trying the test.py, I get this error.
ERROR:UPSUPPORT INVERTER: Supported inverter device_type_code [294] is not supported
I see that someone has a fix for this with a HA docker but I haven't implemented it yet.
Regards
Stephen
Thanks a lot for this work. If you want you can add this inverter :
SungrowInverterModel(0x2600,'SG2.0RS-S','string',2),
this perfectly run on windows with python3.11.
However, on my raspberry Pi (same version of python), have this issue :
in red, the different with windows : "Using proactor "IocProactor"
Any ideas ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.