forked from jsgoecke/tesla
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Streaming API as it is currently broken. (#45)
- Loading branch information
Showing
4 changed files
with
0 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ package main | |
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
|
@@ -11,7 +10,6 @@ import ( | |
|
||
func main() { | ||
ctx := context.Background() | ||
email := "[email protected]" | ||
client, err := tesla.NewClient(ctx, tesla.WithTokenFile("/file/path/to/token.json")) | ||
if err != nil { | ||
panic(err) | ||
|
@@ -62,30 +60,4 @@ func main() { | |
fmt.Println(vehicle.AutoparkForward()) | ||
fmt.Println(vehicle.AutoparkReverse()) | ||
// Take care with these, as the car will move | ||
|
||
// Stream vehicle events | ||
eventChan, errChan, err := vehicle.Stream(email) | ||
if err != nil { | ||
fmt.Println(err) | ||
return | ||
} | ||
|
||
for { | ||
select { | ||
case event := <-eventChan: | ||
eventJSON, _ := json.Marshal(event) | ||
fmt.Println(string(eventJSON)) | ||
case err = <-errChan: | ||
fmt.Println(err) | ||
if err.Error() == "HTTP stream closed" { | ||
fmt.Println("Reconnecting!") | ||
eventChan, errChan, err = vehicle.Stream(email) | ||
if err != nil { | ||
fmt.Println(err) | ||
return | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.