Skip to main content

Method Signature

pub async fn get_device_list(&mut self, plant_id: &str) -> Result<serde_json::Value>
Retrieves a list of MAX inverter devices for a specific plant. This method queries the device management endpoint to get comprehensive device information.

Parameters

plant_id
&str
required
The unique identifier of the plant to retrieve MAX devices from

Returns

Type: Result<serde_json::Value> Returns a JSON value containing device list information. The response typically includes:
  • Device array with MAX inverter details
  • Device serial numbers and status
  • Performance metrics
  • Pagination information (if applicable)

Errors

This method can return the following errors:
  • GrowattError::NotLoggedIn - User is not authenticated
  • GrowattError::RequestError - HTTP request failed
  • GrowattError::InvalidResponse - Empty response or invalid structure
  • GrowattError::JsonError - Failed to parse JSON response

Example

use growatt_api::Growatt;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut client = Growatt::new();
    
    // Login first
    client.login("username", "password").await?;
    
    // Get MAX device list for a plant
    let plant_id = "123456";
    let devices = client.get_device_list(plant_id).await?;
    
    println!("MAX Devices: {}", devices);
    
    Ok(())
}

API Endpoint

POST /device/getMAXList Form Parameters:
  • plantId - The plant identifier
  • currPage - Current page number (defaults to “1”)

Notes

This method automatically handles session management. If the session has expired, it will attempt to re-authenticate using stored credentials before making the request.
The method currently defaults to page 1 (currPage=1). For plants with many devices, you may need to implement pagination handling or use the get_devices_by_plant_list method which supports explicit page numbers.

Build docs developers (and LLMs) love