Method Signature
Description
Retrieves a list of all solar plants associated with the authenticated Growatt account. This method automatically handles authentication by checking the current session and re-authenticating if necessary.Parameters
This method takes no parameters.Return Type
ReturnsResult<PlantList> where:
- Success:
PlantList- A wrapper aroundVec<Plant>containing all plants - Error:
GrowattError- See error cases below
PlantList Structure
Plant Fields
Unique identifier for the plant (mapped from JSON field
id)Name of the plant (mapped from JSON field
name or plantName)Physical address of the plant installation (mapped from JSON field
plantAddress)Installed capacity of the plant in watts (mapped from JSON field
plantPower)Indicates whether the plant is shared with other users (mapped from JSON field
isShare)Code Examples
Basic Usage
Using Environment Variables
Accessing First Plant
Error Cases
The method may return the following errors:GrowattError::NotLoggedIn
Thrown when the session is invalid and no credentials are stored for automatic re-authentication.login() with valid credentials before calling this method.
GrowattError::RequestError
Thrown when the HTTP request fails due to network issues or server problems.- Network connectivity issues
- Growatt server is down or unreachable
- Request timeout
GrowattError::InvalidResponse
Thrown when the API returns an empty response or unexpected data structure.- Session expired during the request
- Account has no plants associated with it
- API response format changed
GrowattError::JsonError
Thrown when the response cannot be parsed into the expected structure.- API response format changed
- Corrupted response data
Implementation Details
API Endpoint
https://server.growatt.com
Authentication
This method automatically callscheck_login() before making the API request, which:
- Checks if the current session is valid
- Re-authenticates using stored credentials if the session expired
- Returns
NotLoggedInerror if no credentials are available
Session Management
The method benefits from automatic session management:- Sessions are valid for 30 minutes by default (configurable)
- Automatic re-authentication happens transparently
- No need to manually check session validity
Related Methods
get_plant(plant_id)- Get detailed information about a specific plantget_weather(plant_id)- Get weather data for a specific plantlogin(username, password)- Authenticate with the Growatt API