Plant struct represents a solar power installation in the Growatt system. It contains basic information about a plant including its ID, name, location, and power capacity.
Structure
This struct is defined in
src/lib.rs:36-47 and uses serde for serialization/deserialization with the Growatt API.Fields
Unique identifier for the plant. Serialized as
"id" in the API.Display name of the plant. Serialized as
"name" in the API, with an alias for "plantName".Physical address or location of the plant. Serialized as
"plantAddress" in the API. This field is optional and may be None.Power capacity in watts. Serialized as
"plantPower" in the API. This field is optional and may be None.Indicates whether the plant is shared with other users. Serialized as
"isShare" in the API. This field is optional and may be None.PlantList
ThePlantList is a wrapper struct containing a vector of plants:
get_plants() method.
Usage Example
Serde Attributes
The struct uses several serde attributes for proper API compatibility:rename: Maps Rust field names to JSON keys (e.g.,plant_id→"id")alias: Allows alternative JSON keys during deserialization (e.g.,"plantName"as an alias for"name")default: Uses default values for missing optional fields during deserialization
Related Types
PlantData- Detailed plant information with energy statisticsget_plants()- Method that returnsPlantListget_plant()- Method that returnsPlantData