SungrowInverter


NameSungrowInverter JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/mvandersteen/SungrowInverter
SummaryA client to allow access to a Sungrow inverter modbus parameters (read only).
upload_time2022-12-12 09:10:07
maintainer
docs_urlNone
authorMark Vandersteen
requires_python>=3.9
license
keywords sungrow inverter modbus tcp
VCS
bugtrack_url
requirements pymodbus pycryptodomex
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SungrowInverter

Provides a way to query Sungrow residential hybrid or string inverters for current state and statistics using ModBus TCP client.

Currently does not support any writing to holding registers.

## Supported Residental Inverters

### Hybrid/Storage Inverters - inverter that support a battery

Residential Hybrid Single Phase Inverter for Low Voltage Battery [48V to 70V]

SH3K6 / SH4K6 / SH5K-V13 (SH5K) / SH5K-20 / SH4K6-30 / SH5K-30 / SH3K6-30

Residential Hybrid Single Phase Inverter wide battery voltage range [80V to 460V]

SH3.6RS / SH4.6RS / SH5.0RS / SH6.0RS

Residential Hybrid Three Phase Inverter wide battery voltage range [80V to 460V]

SH5.0RT / SH6.0RT / SH8.0RT / SH10RT

### String Inverters - Solar panel and grid connection only

SG3.0RT, SG4.0RT, SG5.0RT, SG6.0RT, SG7.0RT,SG8.0RT, SG10RT, SG12RT, SG15RT, SG17RT, SG20RT
SG30KTL-M, SG30KTL-M-V31, SG33KTL-M, SG36KTL-M, SG33K3J, SG49K5J, SG34KJ, LP_P34KSG,
SG50KTL-M-20, SG60KTL, G80KTL, SG80KTL-20, SG60KU-M
SG5KTL-MT, SG6KTL-MT, SG8KTL-M, SG10KTL-M, SG10KTL-MT, SG12KTL-M, SG15KTL-M,
SG17KTL-M, SG20KTL-M,
SG80KTL-M, SG85BF, SG80HV, SG80BF, SG110HV-M, SG111HV, SG125HV, SG125HV-20
SG25CX-SA, SG30CX, SG33CX, SG40CX, SG50CX, SG36CX-US, SG60CX-US, SG75CX, SG100CX
SG100CX-JP, SG110CX, SG136TX, SG225HX, SG250HX
SG250HX-IN, SG250HX-US

Discontinued (as @ 2021-07-12):

SG30KTL, SG10KTL, SG12KTL, SG15KTL, SG20KTL, SG30KU, SG36KTL, SG36KU, SG40KTL,
SG40KTL-M, SG50KTL-M, SG60KTL-M, SG60KU


## Usage

If not called from within an async method

```python
from sungrowinverter inport SungrowInverter
import asyncio
...

client = SungrowInverter("192.168.1.27")

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.
print(client.data)
```

If called within an async method in your application
```
from sungrowinverter inport SungrowInverter

client = SungrowInverter("192.168.1.27")
client.async_update()

#Get a list data returned from the inverter.
print(client.model)
print(client.data)
```

** of course change 192.168.1.127 to your inverter's ip address.

## Methods and Variables

### Contructor

`SungrowInverter(ip_address, port=502, slave=0x01, retries3, timeout=60)`

port: modbus TCP port defaults to 502 on sungrow inverters used here

slave: defaulted to 0x01 as per specs your inverter may need to change this.

retries: number of attempts to query the registers on the inverter before failing

timeout: <in seconds> tcp connection is timed out and fails after this long

### Methods

Available methods

`client.inverter_model()` Returns a object of sungrowinverter.common.SungrowInverterModel with details of model, serial, nominal output power (kWh)

`client.async_update()` Calls set of registers for the relevant inverter and updates data parameter
  
### Parameters Available

#### All inverters
  
  `model:` Provides device model (ie. SH5K - as found in current models supported above)

  `device_code:` Sungrow device code found at register 5000 (refer docs for actual codes if needed)

  `serial_number:` Serial number of the inverter

  `nominal_output_power:` The output power that the inverter supports (ie. SH5K is a 5 kWh inverter and will contain 5.0 in this parameter)

  `inverter_type:` [hybrid | string] - type of sungrow inverter that the client is communicating with, hybrid (battery supported inverter SHxxx series or standard inverter SGxxxx series)

  `mppt_input:` The number of mppt inputs the inverter supports, refer notes below.

  `data:` Provides a dictionary of data of all registers queried (key = register name, value = register value) refer to the https://github.com/mvandersteen/SungrowInverter/tree/main/sungrowinverter/configs for details on what registers are exposed.

#### Hybrid (storage) inverters only
  
  `battery_type:` Show the battery type configured for the inverter

  `battery_energy_capacity:` hybrid only, this will show the capacity of the battery configured for the inverter
  
  
## Note

```
client = SungrowInverter("192.168.1.27")
await client.async_update()
```
  `client.data['export_power']` - for this register it is a signed value if positive then the inverter is exporting to the grid, if negative then it is importing from the grid.

  `client.mppt_inputs` - this value dictates how many client.data['mppt_xx_voltage'] & client.data['mppt_xx_current'] registers are available. These values have been obtained from the modbus specs found in the documents directory on this repository. If an inverter only supports 1 mppt connection then only 1 set of mppt_1_voltage and mppt_1_current will appear. If the inverter supports more then mppt\_\[xx\]\_voltage & mppt\_\[xx\]\_current; where [xx] = the number of mppt inputs the inverter supports; the number available depends on the how many the inverter supports can be 1 to 12 sets of data for current set of support inverters. 
  
## Python Version prior to 3.9

Refer to https://github.com/mvandersteen/SungrowInverter/issues/2 if you are having issues, where @hallonstedt explains how to resolve for a prior version of python.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mvandersteen/SungrowInverter",
    "name": "SungrowInverter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "sungrow,inverter,modbus,tcp",
    "author": "Mark Vandersteen",
    "author_email": "mark@vandersteen.me",
    "download_url": "https://files.pythonhosted.org/packages/e8/17/cf1de5fa8fdb15f2da2681890507cbbb43fc4bd46e763c8aaef9b86c9cbb/SungrowInverter-0.2.0.tar.gz",
    "platform": null,
    "description": "# SungrowInverter\r\n\r\nProvides a way to query Sungrow residential hybrid or string inverters for current state and statistics using ModBus TCP client.\r\n\r\nCurrently does not support any writing to holding registers.\r\n\r\n## Supported Residental Inverters\r\n\r\n### Hybrid/Storage Inverters - inverter that support a battery\r\n\r\nResidential Hybrid Single Phase Inverter for Low Voltage Battery [48V to 70V]\r\n\r\nSH3K6 / SH4K6 / SH5K-V13 (SH5K) / SH5K-20 / SH4K6-30 / SH5K-30 / SH3K6-30\r\n\r\nResidential Hybrid Single Phase Inverter wide battery voltage range [80V to 460V]\r\n\r\nSH3.6RS / SH4.6RS / SH5.0RS / SH6.0RS\r\n\r\nResidential Hybrid Three Phase Inverter wide battery voltage range [80V to 460V]\r\n\r\nSH5.0RT / SH6.0RT / SH8.0RT / SH10RT\r\n\r\n### String Inverters - Solar panel and grid connection only\r\n\r\nSG3.0RT, SG4.0RT, SG5.0RT, SG6.0RT, SG7.0RT\uff0cSG8.0RT, SG10RT, SG12RT, SG15RT, SG17RT, SG20RT\r\nSG30KTL-M, SG30KTL-M-V31, SG33KTL-M, SG36KTL-M, SG33K3J, SG49K5J, SG34KJ, LP_P34KSG,\r\nSG50KTL-M-20, SG60KTL, G80KTL, SG80KTL-20, SG60KU-M\r\nSG5KTL-MT, SG6KTL-MT, SG8KTL-M, SG10KTL-M, SG10KTL-MT, SG12KTL-M, SG15KTL-M,\r\nSG17KTL-M, SG20KTL-M,\r\nSG80KTL-M, SG85BF, SG80HV, SG80BF, SG110HV-M, SG111HV, SG125HV, SG125HV-20\r\nSG25CX-SA, SG30CX, SG33CX, SG40CX, SG50CX, SG36CX-US, SG60CX-US, SG75CX, SG100CX\r\nSG100CX-JP, SG110CX, SG136TX, SG225HX, SG250HX\r\nSG250HX-IN, SG250HX-US\r\n\r\nDiscontinued (as @ 2021-07-12):\r\n\r\nSG30KTL, SG10KTL, SG12KTL, SG15KTL, SG20KTL, SG30KU, SG36KTL, SG36KU, SG40KTL,\r\nSG40KTL-M, SG50KTL-M, SG60KTL-M, SG60KU\r\n\r\n\r\n## Usage\r\n\r\nIf not called from within an async method\r\n\r\n```python\r\nfrom sungrowinverter inport SungrowInverter\r\nimport asyncio\r\n...\r\n\r\nclient = SungrowInverter(\"192.168.1.27\")\r\n\r\nloop = asyncio.new_event_loop()\r\nasyncio.set_event_loop(loop)\r\nresult = loop.run_until_complete(client.async_update())\r\n\r\n#Get a list data returned from the inverter.\r\nprint(client.data)\r\n```\r\n\r\nIf called within an async method in your application\r\n```\r\nfrom sungrowinverter inport SungrowInverter\r\n\r\nclient = SungrowInverter(\"192.168.1.27\")\r\nclient.async_update()\r\n\r\n#Get a list data returned from the inverter.\r\nprint(client.model)\r\nprint(client.data)\r\n```\r\n\r\n** of course change 192.168.1.127 to your inverter's ip address.\r\n\r\n## Methods and Variables\r\n\r\n### Contructor\r\n\r\n`SungrowInverter(ip_address, port=502, slave=0x01, retries3, timeout=60)`\r\n\r\nport: modbus TCP port defaults to 502 on sungrow inverters used here\r\n\r\nslave: defaulted to 0x01 as per specs your inverter may need to change this.\r\n\r\nretries: number of attempts to query the registers on the inverter before failing\r\n\r\ntimeout: <in seconds> tcp connection is timed out and fails after this long\r\n\r\n### Methods\r\n\r\nAvailable methods\r\n\r\n`client.inverter_model()` Returns a object of sungrowinverter.common.SungrowInverterModel with details of model, serial, nominal output power (kWh)\r\n\r\n`client.async_update()` Calls set of registers for the relevant inverter and updates data parameter\r\n  \r\n### Parameters Available\r\n\r\n#### All inverters\r\n  \r\n  `model:` Provides device model (ie. SH5K - as found in current models supported above)\r\n\r\n  `device_code:` Sungrow device code found at register 5000 (refer docs for actual codes if needed)\r\n\r\n  `serial_number:` Serial number of the inverter\r\n\r\n  `nominal_output_power:` The output power that the inverter supports (ie. SH5K is a 5 kWh inverter and will contain 5.0 in this parameter)\r\n\r\n  `inverter_type:` [hybrid | string] - type of sungrow inverter that the client is communicating with, hybrid (battery supported inverter SHxxx series or standard inverter SGxxxx series)\r\n\r\n  `mppt_input:` The number of mppt inputs the inverter supports, refer notes below.\r\n\r\n  `data:` Provides a dictionary of data of all registers queried (key = register name, value = register value) refer to the https://github.com/mvandersteen/SungrowInverter/tree/main/sungrowinverter/configs for details on what registers are exposed.\r\n\r\n#### Hybrid (storage) inverters only\r\n  \r\n  `battery_type:` Show the battery type configured for the inverter\r\n\r\n  `battery_energy_capacity:` hybrid only, this will show the capacity of the battery configured for the inverter\r\n  \r\n  \r\n## Note\r\n\r\n```\r\nclient = SungrowInverter(\"192.168.1.27\")\r\nawait client.async_update()\r\n```\r\n  `client.data['export_power']` - for this register it is a signed value if positive then the inverter is exporting to the grid, if negative then it is importing from the grid.\r\n\r\n  `client.mppt_inputs` - this value dictates how many client.data['mppt_xx_voltage'] & client.data['mppt_xx_current'] registers are available. These values have been obtained from the modbus specs found in the documents directory on this repository. If an inverter only supports 1 mppt connection then only 1 set of mppt_1_voltage and mppt_1_current will appear. If the inverter supports more then mppt\\_\\[xx\\]\\_voltage & mppt\\_\\[xx\\]\\_current; where [xx] = the number of mppt inputs the inverter supports; the number available depends on the how many the inverter supports can be 1 to 12 sets of data for current set of support inverters. \r\n  \r\n## Python Version prior to 3.9\r\n\r\nRefer to https://github.com/mvandersteen/SungrowInverter/issues/2 if you are having issues, where @hallonstedt explains how to resolve for a prior version of python.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A client to allow access to a Sungrow inverter modbus parameters (read only).",
    "version": "0.2.0",
    "split_keywords": [
        "sungrow",
        "inverter",
        "modbus",
        "tcp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "9ab97b051beb1f3eea258659a7ef8208",
                "sha256": "723c44e1593473a13fc6bcf9ba803dd9af0cb345eb39bc10cdac938260040040"
            },
            "downloads": -1,
            "filename": "SungrowInverter-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9ab97b051beb1f3eea258659a7ef8208",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 17234,
            "upload_time": "2022-12-12T09:10:05",
            "upload_time_iso_8601": "2022-12-12T09:10:05.743683Z",
            "url": "https://files.pythonhosted.org/packages/73/75/6647a810d72b6f859f0abd5a3b602c761950abd1f1c3ab18eba0e029eadf/SungrowInverter-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "fcb75c4318318fb73d8163a5b32c1b8e",
                "sha256": "1cb11ff6c38a97a71aaef79778bd68c12b15efb7032b7499d89cc5af7f0d1e6b"
            },
            "downloads": -1,
            "filename": "SungrowInverter-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fcb75c4318318fb73d8163a5b32c1b8e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 14551,
            "upload_time": "2022-12-12T09:10:07",
            "upload_time_iso_8601": "2022-12-12T09:10:07.409999Z",
            "url": "https://files.pythonhosted.org/packages/e8/17/cf1de5fa8fdb15f2da2681890507cbbb43fc4bd46e763c8aaef9b86c9cbb/SungrowInverter-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-12 09:10:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mvandersteen",
    "github_project": "SungrowInverter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pymodbus",
            "specs": [
                [
                    ">=",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "pycryptodomex",
            "specs": [
                [
                    ">=",
                    "3.11.0"
                ]
            ]
        }
    ],
    "lcname": "sungrowinverter"
}
        
Elapsed time: 0.03546s