Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ to the device's internal Wifi access point. For information about how to connect

## Requirements

- Python >= 3.10
- Python >= 3.9

## Usage

Expand All @@ -36,13 +36,13 @@ The above code snippet prints out the current input power value, e.g. `8.342 kW`

During instantiation of a Sun2000 object the following parameters are accepted:

| Parameter | Description |
|-----------|---------------------------------------------------------------------------------------------|
| host | IP address |
| port | Port, usually 502, changed to 6607 on newer firmware versions. |
| timeout | Connection timeout |
| wait | Time to wait after connection before a register read can be performed. Increases stability. |
| slave | Number of inverter unit to be read, used in cascading scenarios. |
| Parameter | Description |
|-----------|-------------------------------------------------------------------------------------------------------------------------------------|
| host | IP address |
| port | Port, usually 502, changed to 6607 on newer firmware versions. |
| timeout | Connection timeout |
| wait | Time to wait after connection before a register read can be performed. Increases stability. |
| slave | Number of inverter unit to be read, used in cascading scenarios. Defaults to 0, but some devices need it to be set to other values. |

### Read metrics

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]
dynamic = ["version", "description"]
requires-python = ">=3.10"
requires-python = ">=3.9"
keywords = ["sun2000", "modbus", "photovoltaic"]
dependencies = [
"pymodbus==3.7.4",
Expand Down
3 changes: 2 additions & 1 deletion sun2000_modbus/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
handler = logging.StreamHandler()
handler.setFormatter(log_format)
logger.addHandler(handler)
logger.propagate = False


class Sun2000:
def __init__(self, host, port=502, timeout=5, wait=2, slave=1):
def __init__(self, host, port=502, timeout=5, wait=2, slave=0): # some models need slave=1
self.wait = wait
self.slave = slave
self.inverter = ModbusTcpClient(host=host, port=port, timeout=timeout)
Expand Down