Reference
APsystemsEZ1M
This class represents an EZ1 Microinverter and provides methods to interact with it over a network. The class allows for getting and setting various device parameters like power status, alarm information, device information, and power limits.
Source code in APsystemsEZ1/__init__.py
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 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 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
__init__(ip_address, port=8050, timeout=10, max_power=800, min_power=30, session=None, enable_debounce=False)
Initializes a new instance of the EZ1Microinverter class with the specified IP address and port.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ip_address |
str
|
The IP address of the EZ1 Microinverter. |
required |
port |
int
|
The port on which the microinverter's server is running. Default is 8050. |
8050
|
timeout |
int
|
The timeout for all requests. The default of 10 seconds should be plenty. |
10
|
Source code in APsystemsEZ1/__init__.py
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 |
|
get_alarm_info()
async
Retrieves the alarm status information for various components of the device. This method makes a request to the "getAlarm" endpoint and returns a dictionary containing the alarm status for different parameters.
The response contains the following attributes:
- offgrid (bool
): Off-Grid Status
_ shortcircuit_1 (bool
): DC 1 Short Circuit Error status
_ shortcircuit_2 (bool
): DC 2 Short Circuit Error status
- operating (bool
): All okay
Returns:
Type | Description |
---|---|
ReturnAlarmInfo | None
|
Information about possible point of failures |
Source code in APsystemsEZ1/__init__.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
get_device_info()
async
Retrieves detailed information about the device. This method sends a request to the "getDeviceInfo" endpoint and returns a dictionary containing various details about the device.
The returned data includes the device ID, device version, the SSID it is connected to, its IP address, and its minimum and maximum power settings. This information can be used for monitoring and configuring the device.
The response contains the following attributes:
- deviceId (
str
): The unique identifier for the device. - devVer (
str
): The version of the device firmware or software. - ssid (
str
): The SSID of the network to which the device is currently connected. - ipAddr (
str
): The current IP address of the device. - minPower (
int
): The minimum power output that the device can be set to, measured in watts. - maxPower (
int
): The maximum power output that the device can be set to, also in watts.
Returns:
Type | Description |
---|---|
ReturnDeviceInfo
|
Different information about the inverter |
Source code in APsystemsEZ1/__init__.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
get_device_power_status()
async
Retrieves the current power status of the device. This method sends a request to the "getOnOff" endpoint and returns a dictionary containing the power status of the device.
The 'data' field in the returned dictionary includes the 'status' key, representing the current power status of the device, where '0' indicates that the device is on, and '1' indicates that it is off.
Returns:
Type | Description |
---|---|
bool
|
0/normal when on, 1/alarm when off |
Source code in APsystemsEZ1/__init__.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
|
get_max_power()
async
Retrieves the set maximum power setting of the device. This method makes a request to the "getMaxPower" endpoint and returns a dictionary containing the maximum power limit of the device set by the user.
Returns:
Type | Description |
---|---|
int | None
|
Max output power in watts |
Source code in APsystemsEZ1/__init__.py
285 286 287 288 289 290 291 292 293 294 |
|
get_output_data()
async
Retrieves the output data from the device. This method calls a private method _request
with the endpoint "getOutputData" to fetch the device's output data.
The returned data includes various parameters such as power output status ('p1', 'p2'), energy readings ('e1', 'e2'), and total energy ('te1', 'te2') for two different inputs of the inverter. Additionally, it provides a status message and the device ID.
The response contains the following attributes:
- p1 (float
): Power output status of inverter input 1
- e1 (float
): Energy reading for inverter input 1
- te1 (float
): Total energy for inverter input 1
- p2 (float
): Power output status of inverter input 2
- e2 (float
): Energy reading for inverter input 2
- te2 (float
): Total energy for inverter input 2
Returns:
Type | Description |
---|---|
ReturnOutputData | None
|
Information about energy/power-related information |
Source code in APsystemsEZ1/__init__.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
get_total_energy_lifetime()
async
Retrieves and calculates the total lifetime energy generated by both inverter inputs 1 and 2. This method first calls get_output_data() to fetch the output data from the device, which includes individual lifetime energy readings for 'te1' and 'te2'. Each of these values represents the total lifetime energy generated by the respective inverter inputs, reported in kilowatt-hours (kWh).
Returns:
Type | Description |
---|---|
float | None
|
The sum of the lifetime energy readings 'te1' and 'te2' as a float, representing the total lifetime energy in kWh generated by both inverter inputs. |
Source code in APsystemsEZ1/__init__.py
271 272 273 274 275 276 277 278 279 280 281 282 283 |
|
get_total_energy_today()
async
Retrieves and calculates the total energy generated today by both inverter inputs, 1 and 2. This method first calls get_output_data() to fetch the output data from the device, which includes individual energy readings for 'e1' and 'e2', each representing the energy in kilowatt-hours (kWh) generated by the respective inverter inputs.
Returns:
Type | Description |
---|---|
float | None
|
The sum of the energy readings 'e1' and 'e2' as a float, representing the total energy generated today in kWh by both inverter inputs. |
Source code in APsystemsEZ1/__init__.py
258 259 260 261 262 263 264 265 266 267 268 269 |
|
get_total_output()
async
Retrieves and calculates the combined power output status of inverter inputs 1 and 2. This method first calls get_output_data() to fetch the output data from the device, which includes individual power output values for 'p1' and 'p2'. It then sums these values to provide the total combined power output.
Returns:
Type | Description |
---|---|
float | None
|
The sum of power output values 'p1' and 'p2' as a float. |
Source code in APsystemsEZ1/__init__.py
246 247 248 249 250 251 252 253 254 255 256 |
|
set_device_power_status(power_status)
async
Sets the power status of the device to either on or off. This method sends a request to the "setOnOff" endpoint with a specified power status parameter. The power status accepts multiple string representations: '0' or 'ON' to start the inverter, and '1', 'SLEEP', or 'OFF' to stop the inverter.
If the provided power status does not match any of the accepted representations, the method raises a ValueError with a descriptive message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
power_status |
bool
|
The desired power status for the device, specified as '0', 'ON' for starting the inverter, or '1', 'SLEEP', 'OFF' for stopping it. |
required |
Returns:
Type | Description |
---|---|
bool | None
|
0/normal when on, 1/alarm when off |
Raises:
Type | Description |
---|---|
ValueError
|
If 'power_status' does not match the accepted values. The error message explains the valid values and their meanings. Note: Internally, the method treats '0' and 'ON' as equivalent, both setting the power status to '0'. Similarly, '1', 'SLEEP', and 'OFF' are treated as equivalent, setting the power status to '1'. |
Source code in APsystemsEZ1/__init__.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
set_max_power(power_limit)
async
Sets the maximum power limit of the device. This method sends a request to the "setMaxPower" endpoint with the specified power limit as a parameter. The power limit must be an integer within the range of 30 to 800 watts.
If the provided power limit is outside this range, the method raises a ValueError.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
power_limit |
int
|
The desired maximum power setting for the device, in watts. Must be an integer between 30 and 800. |
required |
Returns:
Type | Description |
---|---|
int | None
|
(Newly) set max output power in watts |
Raises:
Type | Description |
---|---|
ValueError
|
If 'power_limit' is not within the range of 30 to 800. The key in the 'data' object is: - 'maxPower': Indicates the newly set maximum power output of the device in watts. |
Source code in APsystemsEZ1/__init__.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
|
ReturnOutputData
dataclass
Source code in APsystemsEZ1/__init__.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
__init__(**data)
The data attribute needs to be set manually because the inverter local interface may return more results than the existing data attributes (such as originalData), resulting in an error.
Source code in APsystemsEZ1/__init__.py
41 42 43 44 45 46 47 48 49 50 |
|