From cbec79cfac96c4502b22e8b33ad029ed66a0f8bf Mon Sep 17 00:00:00 2001 From: pitust <41321673+pitust@users.noreply.github.com> Date: Fri, 1 Dec 2023 19:09:59 +0000 Subject: [PATCH] fix(states): add endpoints required for location state 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. --- states.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/states.go b/states.go index 298723f..7ff1c8e 100644 --- a/states.go +++ b/states.go @@ -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 }