Skip to main content

Growatt API Rust SDK

A comprehensive Rust client for interacting with the Growatt API. Build robust applications to monitor and manage your solar energy systems with type-safe, asynchronous operations.

What is Growatt?

Growatt is a leading manufacturer of solar inverters and energy storage solutions. The Growatt API provides programmatic access to your solar plant data, including real-time monitoring, energy statistics, device management, and system diagnostics.

Key Features

Authentication & Session Management

Secure login with automatic session renewal and token management

Plant & Device Management

Retrieve comprehensive plant information and manage multiple devices

Energy Statistics

Access daily, monthly, yearly, and total energy production data

Real-time Monitoring

Get current status, mix device data, and battery statistics

Fault Logging

Access detailed fault logs and device diagnostics

Type-Safe API

Strongly typed responses with comprehensive error handling

What You Can Do

The Growatt API Rust SDK enables you to:
  • Authenticate - Login and maintain secure sessions with the Growatt server
  • Monitor Plants - Retrieve plant lists, detailed information, and weather data
  • Manage Devices - Access device lists, MIX inverter status, and configuration
  • Track Energy - Get energy statistics across different time periods (daily/monthly/yearly)
  • Analyze Performance - Access battery statistics and system performance metrics
  • Diagnose Issues - Retrieve fault logs and device error information
  • Configure Settings - Update device parameters like AC discharge time periods

Library Architecture

The SDK is built with:
  • Async/Await - Powered by tokio for high-performance async operations
  • HTTP Client - Uses reqwest with automatic cookie management
  • Serialization - serde for type-safe JSON handling
  • Error Handling - Custom error types with thiserror

Data Structures

The SDK provides strongly-typed data structures for all API responses:
pub struct Plant {
    pub plant_id: String,
    pub plant_name: String,
    pub plant_address: Option<String>,
    pub plant_watts: Option<f64>,
    pub is_share: Option<bool>,
}

pub struct PlantData {
    pub plant_name: Option<String>,
    pub plant_id: Option<String>,
    pub capacity: Option<f64>,
    pub today_energy: Option<f64>,
    pub total_energy: Option<f64>,
    pub current_power: Option<f64>,
}

Error Handling

Comprehensive error types for robust applications:
pub enum GrowattError {
    RequestError(reqwest::Error),    // HTTP request failures
    JsonError(serde_json::Error),    // JSON parsing errors
    AuthError(String),               // Authentication failures
    InvalidResponse(String),         // Invalid API responses
    NotLoggedIn,                     // Session not established
}
The SDK automatically handles session expiry and re-authentication, making it easy to build long-running applications.

Next Steps

Installation

Add the Growatt SDK to your Rust project

Quick Start

Build your first Growatt application in minutes

Build docs developers (and LLMs) love