Go Jelly
Go Jelly (Source) is an SDK for Autogrow devices and associated integrations.
Currently the IntelliDose is supported when used in combination with the go-intelli gateway.
Installation
Install as you would any go library:
go get github.com/autogrow/go-jelly
Usage
Basic usage would be like so:
import "github.com/AutogrowSystems/go-jelly/ig"
user := "me"
pass := "secret"
client := ig.NewClient(user, pass)
devices, err := client.Devices()
if err != nil {
panic(err)
}
// print the known devices
for _, d := range devices {
fmt.Printf("%-12s %-18s %-20s %s", d.Type, d.ID, d.DeviceName, d.Growroom)
}
doser, err := client.IntelliDose("ASLID17081149")
if err != nil {
panic(err)
}
fmt.Println("Water is currently %0.2f EC and %0.2f pH", doser.Metrics.Ec, doser.Metrics.PH)
// Immediate push to the API
if err := doser.ForceIrrigation(); err != nil {
panic(err)
}
// Push all the changes to the API at once
err := doser.Transaction(func() error) {
doser.ForceIrrigation() // no errors returned in this mode
doser.ForcePHDose()
doser.ForceNutrientDose()
return nil
})
if err != nil {
panic(err)
}
You can see some usage examples under examples:
- examples/daynightonoff.go: send a push notification when an IntelliDose transitions from day to night (or vice versa)
- examples/printreadings.go: print readings to the terminal every time they change
Get Involved
If you would like contribute to Go Jelly's development simply clone the Go Jelly repo from Github and submit a pull request.