Skip to main content

Method Signature

pub async fn get_energy_stats_monthly(
    &mut self,
    date: &str,
    plant_id: &str,
    mix_sn: &str
) -> Result<serde_json::Value>
Retrieves energy statistics for a specific month for a MIX inverter. Returns daily energy production and consumption data for the entire month.

Parameters

date
&str
required
The month for which to retrieve statistics.
Format: YYYY-MM (e.g., “2025-04”)
plant_id
&str
required
The unique identifier of the plant.
mix_sn
&str
required
The serial number of the MIX inverter.

Returns

Result<serde_json::Value>
Result
Returns a Result containing:
  • Ok(serde_json::Value): JSON object with monthly energy statistics including daily breakdown
  • Err(GrowattError): Error if the request fails, authentication is invalid, or response is empty

Example

use growatt_api::GrowattApi;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut api = GrowattApi::new();
    api.login("username", "password").await?;
    
    let stats = api.get_energy_stats_monthly(
        "2025-04",
        "1234567",
        "ABC123XYZ"
    ).await?;
    
    println!("Monthly energy stats: {}", stats);
    
    Ok(())
}

API Endpoint

POST /panel/mix/getMIXEnergyMonthChart

Notes

  • Requires authentication via login() before calling
  • Automatically checks login status before making the request
  • Returns daily energy data for each day in the specified month
  • Throws InvalidResponse error if the response is empty or null

Build docs developers (and LLMs) love