Skip to main content

Method Signature

pub async fn get_energy_stats_daily(
    &mut self,
    date: &str,
    plant_id: &str,
    mix_sn: &str
) -> Result<serde_json::Value>
Retrieves energy statistics for a specific day for a MIX inverter. Returns detailed hourly energy production and consumption data.

Parameters

date
&str
required
The date for which to retrieve statistics.
Format: YYYY-MM-DD (e.g., “2025-04-26”)
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 daily energy statistics including hourly 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_daily(
        "2025-04-26",
        "1234567",
        "ABC123XYZ"
    ).await?;
    
    println!("Daily energy stats: {}", stats);
    
    Ok(())
}

API Endpoint

POST /panel/mix/getMIXEnergyDayChart

Notes

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

Build docs developers (and LLMs) love