API reference¶
intelbras_solar_local.IntelbrasSolarClient ¶
Talks to one inverter through its WiNet-S datalogger.
Modbus TCP is the primary source; the WiNet-S WebSocket adds datalogger connectivity, the fault list and the commercial model, best-effort.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
IP or hostname of the WiNet-S datalogger. |
required |
port
|
int
|
Modbus TCP port. |
DEFAULT_PORT
|
unit
|
int
|
Modbus unit id of the inverter. |
DEFAULT_UNIT
|
session
|
ClientSession | None
|
optional |
None
|
winet_port
|
int
|
WebSocket port of the datalogger web UI. |
DEFAULT_WINET_PORT
|
Source code in src/intelbras_solar_local/client.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
winet
property
¶
winet: WiNetClient
WebSocket client for the datalogger, sharing this client's session.
async_close
async
¶
async_close() -> None
Close the Modbus connection and the session this client created.
Source code in src/intelbras_solar_local/client.py
77 78 79 80 81 82 | |
async_get_inverter_data
async
¶
async_get_inverter_data() -> InverterStatus
Read every polled register block over Modbus.
Raises:
| Type | Description |
|---|---|
IntelbrasSolarConnectionError
|
datalogger unreachable. |
IntelbrasSolarProtocolError
|
Modbus exception reply. |
Source code in src/intelbras_solar_local/client.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
async_get_status
async
¶
async_get_status() -> InverterStatus
Modbus snapshot plus datalogger state (datalogger may be None).
A WebSocket failure never fails the call; only Modbus errors raise.
Source code in src/intelbras_solar_local/client.py
106 107 108 109 110 111 112 113 114 115 116 | |
async_set_inverter_on
async
¶
async_set_inverter_on(on: bool) -> None
Start (True) or stop (False) power generation.
Source code in src/intelbras_solar_local/client.py
118 119 120 | |
async_set_power_limit_enabled
async
¶
async_set_power_limit_enabled(enabled: bool) -> None
Turn the active power limitation on or off.
Source code in src/intelbras_solar_local/client.py
122 123 124 125 126 | |
async_set_power_limit
async
¶
async_set_power_limit(percent: float) -> None
Set the active power limit, 0–100 % of nominal power.
Source code in src/intelbras_solar_local/client.py
128 129 130 131 132 | |
async_set_clock
async
¶
async_set_clock(when: datetime) -> None
Set the inverter clock (one register per field).
Source code in src/intelbras_solar_local/client.py
134 135 136 137 138 | |
intelbras_solar_local.InverterStatus
dataclass
¶
Snapshot of the inverter at a point in time.
online is False when the datalogger could not be read (typically at
night, when the inverter powers down); every other field is then None.
Source code in src/intelbras_solar_local/models.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
intelbras_solar_local.DataloggerStatus
dataclass
¶
State reported by the WiNet-S WebSocket.
Source code in src/intelbras_solar_local/models.py
35 36 37 38 39 40 41 42 43 44 | |
intelbras_solar_local.Mppt
dataclass
¶
One MPPT (string) input.
Source code in src/intelbras_solar_local/models.py
22 23 24 25 26 27 28 29 30 31 32 | |
intelbras_solar_local.parse_registers ¶
parse_registers(inp: dict[int, int], hold: dict[int, int]) -> InverterStatus
Build an :class:InverterStatus from raw input and holding registers.
Sungrow stores 32-bit values low word first.
Source code in src/intelbras_solar_local/models.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
intelbras_solar_local.parse_datalogger ¶
parse_datalogger(state: dict[str, Any], faults: dict[str, Any], devices: dict[str, Any]) -> DataloggerStatus
Build a :class:DataloggerStatus from WiNet-S result_data payloads.
Source code in src/intelbras_solar_local/models.py
175 176 177 178 179 180 181 182 183 184 185 186 187 | |
intelbras_solar_local.ModbusTcpClient ¶
One persistent Modbus TCP connection, reopened on demand after errors.
Source code in src/intelbras_solar_local/modbus.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
async_close
async
¶
async_close() -> None
Close the TCP connection (it reopens on the next request).
Source code in src/intelbras_solar_local/modbus.py
49 50 51 52 53 | |
async_read
async
¶
async_read(function: int, address: int, count: int) -> dict[int, int]
Read count registers starting at address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function
|
int
|
|
required |
address
|
int
|
0-based start register. |
required |
count
|
int
|
number of registers (max 125). |
required |
Returns:
| Type | Description |
|---|---|
dict[int, int]
|
Mapping of register address to its unsigned 16-bit value. |
Source code in src/intelbras_solar_local/modbus.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
async_write
async
¶
async_write(address: int, value: int) -> None
Write one holding register (FC6).
Source code in src/intelbras_solar_local/modbus.py
78 79 80 | |
intelbras_solar_local.WiNetClient ¶
Reads datalogger state, faults and the device list over WebSocket.
Source code in src/intelbras_solar_local/winet.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
async_get_status
async
¶
async_get_status() -> DataloggerStatus
Open a session, read state, fault and devicelist, close.
Source code in src/intelbras_solar_local/winet.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
intelbras_solar_local.IntelbrasSolarError ¶
Bases: Exception
Base error for all Intelbras Solar client failures.
Source code in src/intelbras_solar_local/exceptions.py
5 6 | |
intelbras_solar_local.IntelbrasSolarConnectionError ¶
Bases: IntelbrasSolarError
Raised when the datalogger is unreachable or the transport fails.
Source code in src/intelbras_solar_local/exceptions.py
9 10 | |
intelbras_solar_local.IntelbrasSolarProtocolError ¶
Bases: IntelbrasSolarError
Raised when the device answers with an error (Modbus exception, bad reply).
Source code in src/intelbras_solar_local/exceptions.py
13 14 | |