0e5b9aae19079c5579d072742b49a1353e441df6
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s
MySubaru!GO
Is a simple API client to interact with My Subaru service (https://www.mysubaru.com/) via HTTP, written in Go
News
- v0.0.0-dev First public release on April 11, 2023
Features
- Simple and chainable methods for settings and request
Installation
# Go Modules
go get git.savin.nyc/alex/mysubaru
Usage
The following samples will assist you to become as comfortable as possible with mysubaru library.
// Import hassky into your code and refer it as `mysubaru`.
import "git.savin.nyc/alex/mysubaru"
Create a new MySubaru API Client
// Create a MySubaru Client
msc, err := mysubaru.New(cfg)
if err != nil {
cfg.Logger.Error("cannot create MySubaru client", "error", err)
os.Exit(1)
}
Get a car by VIN
outback, err := msc.GetVehicleByVIN("1HGCM82633A004352")
if err != nil {
cfg.Logger.Error("cannot get a vehicle by VIN", "error", err)
os.Exit(1)
}
Start/Stop Lights request
// Execute a LightsStart command
events, err := outback.LightsStart()
if err != nil {
cfg.Logger.Error("cannot execute LightsStart command", "error", err)
os.Exit(1)
}
for event := range events {
fmt.Printf("Lights Start Event: %+v\n", event)
}
// Wait for a while to see the lights on
time.Sleep(20 * time.Second)
// Execute a LightsStop command
events, err = outback.LightsStop()
if err != nil {
cfg.Logger.Error("cannot execute LightsStop command", "error", err)
os.Exit(1)
}
for event := range events {
fmt.Printf("Lights Stop Event: %+v\n", event)
}
Description
Languages
Go
100%