flobz / psa_car_controller

Control psa car with connected_car v4 API.
GNU General Public License v3.0
403 stars 210 forks source link

API returned error #513

Closed jasworks closed 1 year ago

jasworks commented 1 year ago

I’ve encountered an error which produced the following in the log:

2023-04-12 15:51:40,150 :: ERROR :: refresh_vehicle_info: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psacc/application/psa_client.py", line 125, in __refresh_vehicle_info self.get_vehicle_info(car.vin) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psacc/application/psa_client.py", line 104, in get_vehicle_info res = self.api().get_vehicle_status(car.vehicle_id, extension=["odometer"]) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1229, in get_vehicle_status (data) = self.get_vehicle_status_with_http_info(id, **kwargs) # noqa: E501 File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1293, in get_vehicle_status_with_http_info return self.api_client.call_api( File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/oauth.py", line 78, in call_api return self._ApiClient__call_api(resource_path, method, File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 169, in __call_api return_data = self.deserialize(response_data, response_type) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 241, in deserialize return self.__deserialize(data, response_type) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize return self.__deserialize_model(data, klass) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 624, in __deserialize_model kwargs[attr] = self.__deserialize(value, attr_type) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize return self.__deserialize_model(data, klass) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 624, in __deserialize_model kwargs[attr] = self.__deserialize(value, attr_type) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize return self.__deserialize_model(data, klass) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 626, in __deserialize_model instance = klass(**kwargs) File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/models/position_properties.py", line 61, in __init__ self.type = type File "/usr/local/lib/python3.9/site-packages/psa_car_controller/psa/connected_car_api/models/position_properties.py", line 131, in type raise ValueError( ValueError: Invalid value fortype(Acquire), must be one of ['Estimated', 'Acquired', 'Estimate', 'Aquire'] To Reproduce Steps to reproduce the behavior:

  1. what command did you use - I use docker
  2. when the bug append ? Since 2023-04-12
  3. Does it persist after restarting the program? Yes
  4. Does it persist after recreate config by going to http://server_address:port/config? Yes

Believed that some changes were done in the API (which fixed a typo) causing it to break.

show2go commented 1 year ago

Same here! --> HA Addon thx

youradds commented 1 year ago

What car is this for? I'm having issues with a Vauxhall Corsa-e, and I get (I think the same?)

Exception on /get_vehicleinfo/VXKUHZKXZL41REDACTED [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/web/view/views.py", line 146, in get_vehicle_info
    response=json.dumps(APP.myp.get_vehicle_info(vin, from_cache).to_dict(), default=str),
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psacc/application/psa_client.py", line 104, in get_vehicle_info
    res = self.api().get_vehicle_status(car.vehicle_id, extension=["odometer"])
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1229, in get_vehicle_status
    (data) = self.get_vehicle_status_with_http_info(id, **kwargs)  # noqa: E501
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1293, in get_vehicle_status_with_http_info
    return self.api_client.call_api(
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/oauth.py", line 78, in call_api
    return self._ApiClient__call_api(resource_path, method,
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 169, in __call_api
    return_data = self.deserialize(response_data, response_type)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 241, in deserialize
    return self.__deserialize(data, response_type)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 624, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 624, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 626, in __deserialize_model
    instance = klass(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/models/position_properties.py", line 61, in __init__
    self.type = type
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/models/position_properties.py", line 131, in type
    raise ValueError(
ValueError: Invalid value for `type` (Acquire), must be one of ['Estimated', 'Acquired', 'Estimate', 'Aquire']
2023-04-12 15:29:17,636 :: ERROR :: Exception on /get_vehicleinfo/VXKUHZKXZL41REDACTED [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/web/view/views.py", line 146, in get_vehicle_info
    response=json.dumps(APP.myp.get_vehicle_info(vin, from_cache).to_dict(), default=str),
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psacc/application/psa_client.py", line 104, in get_vehicle_info
    res = self.api().get_vehicle_status(car.vehicle_id, extension=["odometer"])
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1229, in get_vehicle_status
    (data) = self.get_vehicle_status_with_http_info(id, **kwargs)  # noqa: E501
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1293, in get_vehicle_status_with_http_info
    return self.api_client.call_api(
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/oauth.py", line 78, in call_api
    return self._ApiClient__call_api(resource_path, method,
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 169, in __call_api
    return_data = self.deserialize(response_data, response_type)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 241, in deserialize
    return self.__deserialize(data, response_type)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 624, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 624, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 280, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 626, in __deserialize_model
    instance = klass(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/models/position_properties.py", line 61, in __init__
    self.type = type
  File "/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/models/position_properties.py", line 131, in type
    raise ValueError(
ValueError: Invalid value for `type` (Acquire), must be one of ['Estimated', 'Acquired', 'Estimate', 'Aquire']
2023-04-12 15:29:17,644 :: INFO :: 127.0.0.1 - - [12/Apr/2023 15:29:17] "GET /get_vehicleinfo/VXKUHZKXZL41REDACTED HTTP/1.0" 500 -

I was having issues with the MyVauxhall app (e-remote), and they finally fixed that. But this program still doesn't work :( (frustrating, as it was my go-to with my own web-app wrapped around this, which was more reliable than myVauxhall haha)

humarf commented 1 year ago

I can confirm. Same problem here with a Citroen eC4. I guess there was an API change.

francogodi commented 1 year ago

same here with a Peugeot e208, I guess something has changed in the API since most of the values are null in get_vehicleinfo except "level" and "updated_at"

jordivicedo commented 1 year ago

I have the same problem and #512 Solves the error, but I still get no information about mileage

jasworks commented 1 year ago

I just created #514 but seems like #512 also fixed the error. Let’s see which one got merged.

bbr111 commented 1 year ago

Can confirm the issue and the fix is working.

But is still did not get any Mileage information. just the soc from the car.

mdkeil commented 1 year ago

same here, no mileage.

Matssa56 commented 1 year ago

Anyone has an updated HA docker image that I can use? Or maybe a dockerfile that uses an updated pyproject? Thanks!

mdkeil commented 1 year ago

You can make a temporary file-bind (docker) with the changed position_properties.py (/usr/local/lib/python3.10/dist-packages/psa_car_controller/psa/connected_car_api/models/position_properties.py)

jasworks commented 1 year ago

I’ve got one for now jasworks/psa-car-controller:latestAm going to send out a pull request that help build the package and the docker image at the same time. Sent from my iPhoneOn 12 Apr 2023, at 21:45, Matssa @.***> wrote: Anyone has an updated HA docker image that I can use? Or maybe a dockerfile that uses an updated pyproject? Thanks!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

youradds commented 1 year ago

Wahoo - this has sorted mine :)

jasworks commented 1 year ago

I guess this can be closed :)

CWfFO commented 1 year ago

Hi, i run the latest version outside docker (so normal installation) and updated to the latest version. I still get this error. I did the update with wget https://github.com/flobz/psa_car_controller/archive/refs/heads/master.zip and unzip master.zip. Anything else to do?