Skip to content

Commit

Permalink
fix(states): add endpoints required for location state
Browse files Browse the repository at this point in the history
The tesla API updated, requiring the `endpoints` parameter in `vehicle_data`
to return some types of information (like vehicle location). Add this
parameter to the request so that the existing API continues to function.
  • Loading branch information
pitust authored Dec 1, 2023
1 parent 2ca3c53 commit cbec79c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion states.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func stateError(sr *VehicleData) error {
// A utility function to fetch the appropriate state of the vehicle
func (c *Client) fetchState(id int64) (*VehicleData, error) {
var res VehicleData
path := strings.Join([]string{c.baseURL, "vehicles", strconv.FormatInt(id, 10), "vehicle_data"}, "/")
path := strings.Join([]string{c.baseURL, "vehicles", strconv.FormatInt(id, 10), "vehicle_data?endpoints=charge_state%3Bclimate_state%3Bclosures_state%3Bdrive_state%3Bgui_settings%3Blocation_data%3Bvehicle_config"}, "/")
if err := c.getJSON(path, &res); err != nil {
return nil, err
}
Expand Down

0 comments on commit cbec79c

Please sign in to comment.