Method Signature
Description
Retrieves detailed information about a specific solar plant, including current power generation, energy statistics, and capacity. This method automatically handles authentication by checking the current session and re-authenticating if necessary.Parameters
The unique identifier of the plant. This ID can be obtained from the
get_plants() method.Return Type
ReturnsResult<PlantData> where:
- Success:
PlantData- Detailed plant information and statistics - Error:
GrowattError- See error cases below
PlantData Structure
PlantData Fields
Name of the plant (mapped from JSON field
plantName)Unique identifier for the plant (mapped from JSON field
plantId)Total installed capacity of the plant in kilowatts (kW)
Energy generated today in kilowatt-hours (kWh) (mapped from JSON field
todayEnergy)Cumulative energy generated over the plant’s lifetime in kilowatt-hours (kWh) (mapped from JSON field
totalEnergy)Current power output in watts (W) (mapped from JSON field
currentPower)Code Examples
Basic Usage
Get Details for All Plants
Calculate Efficiency
Monitor Plant in Real-Time
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::InvalidResponse (Empty Response)
Thrown when the API returns an empty response or the plant data object is null.- Invalid plant ID
- Session expired during the request
- Plant does not exist or is not accessible to the authenticated user
GrowattError::InvalidResponse (Invalid Structure)
Thrown when the API response does not contain the expectedobj field.
- API response format changed
- Server returned an error response
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::JsonError
Thrown when the response cannot be parsed into the expectedPlantData structure.
- API response format changed
- Unexpected data types in response fields
Implementation Details
API Endpoint
https://server.growatt.com
Response Structure
The API returns a JSON response with the following structure:obj field and deserializes it into the PlantData struct.
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
Optional Fields
All fields inPlantData are Option<T> types because:
- The API may not return all fields depending on plant type or configuration
- Some values may be null during nighttime or when the plant is offline
- This design allows for flexible handling of partial data
Related Methods
get_plants()- Get a list of all plants to obtain plant IDsget_weather(plant_id)- Get weather data for the plant locationget_device_list(plant_id)- Get devices associated with the plantget_mix_ids(plant_id)- Get inverter IDs for the plant