bimmerconnected / bimmer_connected

🚘 Library to query the status of your BMW or Mini from the ConnectedDrive portal
Apache License 2.0
365 stars 79 forks source link

CLI: Set observer position only for vehicle finder #645

Closed rikroe closed 1 month ago

rikroe commented 2 months ago

Proposed change

Set observer position from positional arguments only for vehicle finder.

Type of change

Additional information

Checklist

rikroe commented 2 months ago

@jeterke could you try this out just from the code change? Cannot test it, don't have an EV.

jeterke commented 1 month ago

Tested. Charging start/stop now works fine. Great news!

However, I also tested vehiclefinder and discovered that there is a problem. See below. Not an issue for me since I don't use it.

DEBUG:bimmer_connected.account:Getting vehicle list DEBUG:bimmer_connected.account:Getting vehicle list DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vcs/v5/vehicle-list "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v5/vehicle-data/profile "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vcs/v5/vehicle-list "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vcs/v5/vehicle-list "HTTP/1.1 200 OK" DEBUG:bimmer_connected.vehicle.vehicle:Getting vehicle list DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=0&appDateTime=1722932370640 "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-crccs/v2/vehicles?fields=charging-profile&has_charging_settings_capabilities=true "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vrccs/v4/presentation/remote-commands/vehicle-finder "HTTP/1.1 200 OK" DEBUG:bimmer_connected.vehicle.remote_services:getting remote service status for '9fdd4153-e2bb-4322-acd3-xxxxxxxxxx' DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vrccs/v3/presentation/remote-commands/eventStatus?eventId=9fdd4153-e2bb-4322-acd3-637abc970739 "HTTP/1.1 200 OK" DEBUG:bimmer_connected.vehicle.remote_services:current state of '9fdd4153-e2bb-4322-acd3-xxxxxxxxxx' is: EXECUTED DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vrccs/v4/presentation/remote-commands/eventPosition?eventId=9fdd4153-e2bb-4322-acd3-637abc970739 "HTTP/1.1 400 Bad Request" ERROR:bimmer_connected.api.client:MyBMWAPIError due to HTTPStatusError: Bad Request - MyBMWAPIError: HTTPStatusError: Bad Request -

Switched back to version 0.16.1 and vehiclefinder works fine in that version: DEBUG:bimmer_connected.account:Getting vehicle list DEBUG:bimmer_connected.account:Getting vehicle list DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vcs/v5/vehicle-list "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v5/vehicle-data/profile "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vcs/v5/vehicle-list "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vcs/v5/vehicle-list "HTTP/1.1 200 OK" DEBUG:bimmer_connected.vehicle.vehicle:Getting vehicle list DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=0&appDateTime=1722932567959 "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-crccs/v2/vehicles?fields=charging-profile&has_charging_settings_capabilities=true "HTTP/1.1 200 OK" DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vrccs/v4/presentation/remote-commands/vehicle-finder "HTTP/1.1 200 OK" DEBUG:bimmer_connected.vehicle.remote_services:getting remote service status for '1f42e9af-4db4-48a8-9009-62e0b357287a' DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vrccs/v3/presentation/remote-commands/eventStatus?eventId=1f42e9af-4db4-48a8-9009-62e0b357287a "HTTP/1.1 200 OK" DEBUG:bimmer_connected.vehicle.remote_services:current state of '1f42e9af-4db4-48a8-9009-xxxxxxxxxx' is: PENDING DEBUG:bimmer_connected.vehicle.remote_services:getting remote service status for '1f42e9af-4db4-48a8-9009-62e0b357287a' DEBUG:httpx._client:HTTP Request: POST https://cocoapi.bmwgroup.com/eadrax-vrccs/v3/presentation/remote-commands/eventStatus?eventId=1f42e9af-4db4-48a8-9009-62e0b357287a "HTTP/1.1 200 OK" DEBUG:bimmer_connected.vehicle.remote_services:current state of '1f42e9af-4db4-48a8-9009-xxxxxxxxxxxx' is: EXECUTED ERROR:bimmer_connected.vehicle.location:Error retrieving vehicle position. Unknown position: Set observer position to retrieve vehicle coordinates! ExecutionState.EXECUTED {'gps_position': GPSPosition(latitude=5x.xxxxxxxxxxxxxxxxxx, longitude=4.xxxxxxxxxxxxxxxxxx), 'heading': xxx}

rikroe commented 1 month ago

Thanks for testing, this should not fail. I'll have another look!

rikroe commented 1 month ago

Just tried it out myself - did you add the lat and lon parameters? They may be required for the new endpoint added with 0.16.0 and I see in your working example that the request is against v3 instead of v4.