Quick Start Guide
Get up and running with the Growatt API in minutes. This guide walks you through creating a client, authenticating, and retrieving your plant data.Basic Usage
Create a new Growatt client
Initialize the client with default settings:The client is created with:
- Default base URL:
https://server.growatt.com - 30-minute session duration
- Automatic cookie management
Login to authenticate
Authenticate with your Growatt credentials:The
login() method:- Returns
Result<bool, GrowattError> - Automatically hashes the password with MD5
- Stores session cookies for subsequent requests
- Sets session expiry time
Retrieve your plants
Get a list of all plants associated with your account:
The
PlantList struct contains a vector of Plant objects. Access the inner vector with .0.Complete Example
Here’s a complete working example:src/main.rs
Environment-Based Configuration
For production applications, use environment variables:Advanced Client Configuration
Custom Session Duration
Alternative Server URL
Chain Configuration
Error Handling
Handle errors gracefully:Type Signatures
Key method signatures:What’s Next?
Now that you’ve completed the quick start, explore more advanced features:Authentication
Learn about session management and token handling
Plant Management
Retrieve detailed plant information and statistics
Energy Statistics
Access daily, monthly, and yearly energy data
Error Handling
Build robust applications with proper error handling