package main import ( "fmt" "log" "os" "time" "git.savin.nyc/alex/mysubaru" "git.savin.nyc/alex/mysubaru/config" ) func main() { var err error configFile, err := os.ReadFile("config.yaml") if err != nil { log.Fatal(err) } cfg, err := config.FromBytes(configFile) if err != nil { log.Fatal(err) } // cfg.Logger.Debug("printing config", "config", cfg) msc, err := mysubaru.New(cfg) if err != nil { cfg.Logger.Error("cannot create MySubaru client", "error", err) os.Exit(1) } // 11.6MMAN ABS_MIL ACCS AHBL_MIL ATF_MIL AWD_MIL BSD BSDRCT_MIL CEL_MIL EBD_MIL EOL_MIL EPAS_MIL EPB_MIL ESS_MIL EYESIGHT ISS_MIL NAV_TOMTOM OPL_MIL RAB_MIL RCC REARBRK RES RESCC RHSF RPOI RPOIA SRS_MIL TEL_MIL TIF_35 TIR_33 TPMS_MIL VDC_MIL WASH_MIL g2 // subaru1 := mysubaru.GetVehicleByVIN("4S4BTGND8L3137058") // fmt.Printf("SUBARU #2 (Vehicle Status):\n") // subaru1.GetVehicleStatus() // fmt.Printf("SUBARU #2 (Vehicle Condition):\n") // subaru1.GetVehicleCondition() // fmt.Printf("SUBARU #1: %+v\n", subaru1) // fmt.Printf("GEN #1: %+v\n\n", subaru1.getAPIGen()) // ABS_MIL ACCS AHBL_MIL ATF_MIL AWD_MIL BSD BSDRCT_MIL CEL_MIL EBD_MIL EOL_MIL EPAS_MIL EPB_MIL ESS_MIL EYESIGHT ISS_MIL OPL_MIL PANPM-TUIRWAOC PWAAADWWAP RAB_MIL RCC REARBRK RES RESCC RHSF RPOI RPOIA RTGU RVFS SRH_MIL SRS_MIL TEL_MIL TIF_35 TIR_33 TLD TPMS_MIL VALET VDC_MIL WASH_MIL g3 outback, err := msc.GetVehicleByVin("4S4BTGPD0P3199198") if err != nil { cfg.Logger.Error("cannot get a vehicle by VIN", "error", err) os.Exit(1) } fmt.Printf("SUBARU #1 (Vehicle Status): %s\n", outback) // // Execute a Lock command // events, err := outback.EngineStart(5, 0, true) // if err != nil { // cfg.Logger.Error("cannot execute Lock command", "error", err) // os.Exit(1) // } // for event := range events { // fmt.Printf("Lock Event: %+v\n", event) // } // 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) } // // Execute a Unlock command // events, err := outback.Unlock() // if err != nil { // cfg.Logger.Error("cannot execute Unlock command", "error", err) // os.Exit(1) // } // for event := range events { // fmt.Printf("Unlock Event: %+v\n", event) // } // // Wait for a while to see the lights on // time.Sleep(20 * time.Second) // // Execute a Lock command // events, err = outback.Lock() // if err != nil { // cfg.Logger.Error("cannot execute Lock command", "error", err) // os.Exit(1) // } // for event := range events { // fmt.Printf("Lock Event: %+v\n", event) // } // Execute a forced GetLocation command // events, err = outback.GetLocation(true) // if err != nil { // cfg.Logger.Error("cannot execute forced GetLocation command", "error", err) // os.Exit(1) // } // for event := range events { // fmt.Printf("GeoLocation Event: %+v\n", event) // } } // {"time":"2025-07-21T18:05:30.987314-04:00","level":"DEBUG","source":{"function":"git.savin.nyc/alex/mysubaru.(*Client).execute","file":"/Users/alex/go/pkg/mod/git.savin.nyc/alex/mysubaru@v0.0.0-20250721200300-3809ed5883b4/client.go","line":372},"msg":"executed GET request","method":"GET","url":"/g2v31/service/g2/remoteEngineQuickStartSettings/fetch.json","params":{}} // {"time":"2025-07-21T18:05:31.014014-04:00","level":"DEBUG","source":{"function":"git.savin.nyc/alex/mysubaru.(*Client).execute","file":"/Users/alex/go/pkg/mod/git.savin.nyc/alex/mysubaru@v0.0.0-20250721200300-3809ed5883b4/client.go","line":404},"msg":"parsed http request output","data":"{\"success\":true,\"errorCode\":null,\"dataName\":null,\"data\":\"{\\\"name\\\":\\\"Cooling\\\",\\\"runTimeMinutes\\\":\\\"10\\\",\\\"climateZoneFrontTemp\\\":\\\"65\\\",\\\"climateZoneFrontAirMode\\\":\\\"FEET_FACE_BALANCED\\\",\\\"climateZoneFrontAirVolume\\\":\\\"7\\\",\\\"outerAirCirculation\\\":\\\"outsideAir\\\",\\\"heatedRearWindowActive\\\":\\\"false\\\",\\\"heatedSeatFrontLeft\\\":\\\"HIGH_COOL\\\",\\\"heatedSeatFrontRight\\\":\\\"HIGH_COOL\\\",\\\"airConditionOn\\\":\\\"false\\\",\\\"canEdit\\\":\\\"true\\\",\\\"disabled\\\":\\\"false\\\",\\\"presetType\\\":\\\"userPreset\\\",\\\"startConfiguration\\\":\\\"START_ENGINE_ALLOW_KEY_IN_IGNITION\\\"}\"}"} // {"time":"2025-07-21T18:03:44.461646-04:00","level":"DEBUG","source":{"function":"git.savin.nyc/alex/mysubaru.(*Client).execute","file":"/Users/alex/go/pkg/mod/git.savin.nyc/alex/mysubaru@v0.0.0-20250721200300-3809ed5883b4/client.go","line":372},"msg":"executed GET request","method":"GET","url":"/g2v31/service/g2/remoteEngineQuickStartSettings/fetch.json","params":{}} // {"time":"2025-07-21T18:03:44.475745-04:00","level":"DEBUG","source":{"function":"git.savin.nyc/alex/mysubaru.(*Client).execute","file":"/Users/alex/go/pkg/mod/git.savin.nyc/alex/mysubaru@v0.0.0-20250721200300-3809ed5883b4/client.go","line":404},"msg":"parsed http request output","data":"{\"success\":true,\"errorCode\":null,\"dataName\":null,\"data\":\"{\\\"airConditionOn\\\":\\\"false\\\",\\\"climateSettings\\\":\\\"climateSettings\\\",\\\"climateZoneFrontAirMode\\\":\\\"FEET_WINDOW\\\",\\\"climateZoneFrontAirVolume\\\":\\\"7\\\",\\\"climateZoneFrontTemp\\\":\\\"65\\\",\\\"heatedRearWindowActive\\\":\\\"false\\\",\\\"heatedSeatFrontLeft\\\":\\\"HIGH_COOL\\\",\\\"heatedSeatFrontRight\\\":\\\"HIGH_COOL\\\",\\\"name\\\":\\\"Cooling\\\",\\\"outerAirCirculation\\\":\\\"outsideAir\\\",\\\"runTimeMinutes\\\":\\\"10\\\",\\\"startConfiguration\\\":\\\"START_ENGINE_ALLOW_KEY_IN_IGNITION\\\"}\\n\"}"} // {"time":"2025-07-21T18:03:44.475885-04:00","level":"ERROR","source":{"function":"git.savin.nyc/alex/mysubaru.(*Vehicle).GetClimateQuickPresets","file":"/Users/alex/go/pkg/mod/git.savin.nyc/alex/mysubaru@v0.0.0-20250721200300-3809ed5883b4/vehicle.go","line":498},"msg":"error while parsing climate quick presets json","request":"GetClimateQuickPresets","error":"invalid character '\"' after top-level value"}