https://github.com/skoef/growatt
Growatt API Golang client
https://github.com/skoef/growatt
golang growatt
Last synced: about 1 year ago
JSON representation
Growatt API Golang client
- Host: GitHub
- URL: https://github.com/skoef/growatt
- Owner: skoef
- Created: 2019-10-28T13:30:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-02T13:55:05.000Z (over 3 years ago)
- Last Synced: 2025-04-03T15:52:30.840Z (about 1 year ago)
- Topics: golang, growatt
- Language: Go
- Size: 11.7 KB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Growatt API Golang client
[](https://goreportcard.com/report/github.com/skoef/growatt) [](http://godoc.org/github.com/skoef/growatt) [](https://travis-ci.com/skoef/growatt/)
This is a simple golang library using the rather quirky Growatt API on https://server.growatt.com. This libary is inspired by indykoning's [PyPi_GrowattServer](https://github.com/indykoning/PyPi_GrowattServer) and Sjord's [growatt_api_client](https://github.com/Sjord/growatt_api_client). It tries to normalize objects as much as possible, so API output is parsed and then converted into defined types within the library.
For simplicity sake, currently only several API endpoints are supported. If you miss specific features in the library, please open an issue!
## Example usage
An example for using the API client is shown below, where the credentials are those you would login to https://server.growatt.com/ with:
```golang
package main
import (
"fmt"
"github.com/skoef/growatt"
)
func main() {
api := growatt.NewAPI("johndoe", "s3cr3t")
plants, err := api.GetPlantList()
if err != nil {
panic(err)
}
fmt.Printf("found %d plants in your Growatt account\n", len(plants))
for _, plant := range plants {
inverters, err := api.GetPlantInverterList(plant.ID)
if err != nil {
continue
}
fmt.Printf("plant %d has %d inverters\n", plant.ID, len(inverters))
for _, inverter := range inverters {
fmt.Printf("inverter %s is generating %0.2fW\n", inverter.Serial, inverter.CurrentPower)
}
fmt.Printf("the plant's total combined power is %0.2fW\n", plant.CurrentPower)
}
}
```