bimmerconnected / bimmer_connected

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

"HTTP/1.1 404 Resource Not Found" #544

Closed xsherlockpl closed 1 year ago

xsherlockpl commented 1 year ago

Describe the issue

Got back from holidays and noticed that the script is running into trouble again. Some time in the last 10 days they broke the API. I have changed the password some 2 months ago and it worked 2 weeks ago just fine. Now the Android app is getting data correctly but not the script.

Not sure if that is quota related as I only call the script every 15 minutes so max 96 times a day. I read somewhere the limit is 120 per day.

When I login on the web and go to the settings of my car they display error getting data.

image

Not sure what is it here, as I rarely use that site and they change it every 6-12 month.

I use the latest script release 0.13.7

Anyone else has problems with the script?

Expected behavior

I would expect it gets the status XML as previously so I can extract the fields with my custom script.

Which Home Assistant version are you using?

none I just use the script in cli

What was the last working version of Home Assistant Core?

none I just use the script in cli

What is your region?

Rest of world

MyBMW website

Number of cars

Output of bimmer_connected fingerprint

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.api.authentication:Authenticating with MyBMW flow for North America & Rest of World.
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-ucs/v1/presentation/oauth/config "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate "HTTP/1.1 302 Found"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/token "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles "HTTP/1.1 404 Resource Not Found"
Traceback (most recent call last):
  File "/home/sherlock/.local/bin/bimmerconnected", line 8, in <module>
    sys.exit(main())

Anything in the logs that might be useful for us?

No response

Additional information

No response

cholawo commented 1 year ago

It's working for me and I notice that when I run fingerprint, I see a few differences in my fingerprint output to yours (and I am rest of world with an i3 too). See the v4 in the urls, and the addition of interaction-id. Just in case that helps someone else to diagnose the problem.

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.api.authentication:Authenticating with MyBMW flow for North America & Rest of World.
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-ucs/v1/presentation/oauth/config "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate?interaction-id=87d4841e-a047-4fc6-b183-1e91d6f5af73&client-version=android%28TQ2A.230405.003.B2%29%3Bbmw%3B3.3.1%2822418%29%3Brow "HTTP/1.1 302 Found"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/token "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=60.0&appDateTime=1688140324225 "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=false "HTTP/1.1 200 OK"
rikroe commented 1 year ago

@cholawo is on the right track here - it doesn't look like as if you are calling it using the most recent version. You can double check using python -c "import bimmer_connected; print(bimmer_connected.__version__);".

Please try a pip uninstall bimmer_connected and then reinstall.

xsherlockpl commented 1 year ago
sherlock@ubuntutest:~$ python3 -c "import bimmer_connected; print(bimmer_connected.__version__);"
0.10.1

very strange

sherlock@ubuntutest:~$  sudo pip3 install --upgrade bimmer_connected
[sudo] password for sherlock:
Requirement already up-to-date: bimmer_connected in /usr/local/lib/python3.8/dist-packages (0.13.7)

ok then lets uninistall it resinstall it

sherlock@ubuntutest:~$ sudo pip uninstall bimmer_connected
Found existing installation: bimmer-connected 0.13.7
Uninstalling bimmer-connected-0.13.7:
  Would remove:
    /usr/local/bin/bimmerconnected
    /usr/local/lib/python3.8/dist-packages/bimmer_connected-0.13.7.dist-info/*
    /usr/local/lib/python3.8/dist-packages/bimmer_connected/*
Proceed (y/n)? y
  Successfully uninstalled bimmer-connected-0.13.7
sherlock@ubuntutest:~$  python3 -c "import bimmer_connected; print(bimmer_connected.__version__);"
0.10.1
sherlock@ubuntutest:~$
sherlock@ubuntutest:~$ sudo pip uninstall bimmer_connected
WARNING: Skipping bimmer-connected as it is not installed.
sherlock@ubuntutest:~$  python3 -c "import bimmer_connected; print(bimmer_connected.__version__);"
0.10.1

but it is still there

sherlock@ubuntutest:/home$ bimmerconnected
usage: bimmerconnected [-h] {status,fingerprint,lightflash,vehiclefinder,image,sendpoi,sendpoi_from_address} ...

wtf it is still there if I do your import command or call it from CLI, but pip claims it is not installed ,no idea how that happened, help TIA

rikroe commented 1 year ago

According to your original log, it is installed in your user folder (/home/sherlock/.local/bin/bimmerconnected). This happens if you do a pip install without permissions to write into the global package store. Maybe you installed once with pip install --user ...?

Try doing a pip uninstall bimmer_connected (without the sudo).

xsherlockpl commented 1 year ago

That was it, many thanks! I unisinstaled user version and installed again but now for some reason an only call bimmerconnected using sudo

sherlock@ubuntutest:~$ sudo bimmerconnected
usage: bimmerconnected [-h] {status,fingerprint,lightflash,horn,vehiclefinder,chargingsettings,chargingprofile,charge,image,sendpoi,sendpoi_from_address} ...
bimmerconnected: error: the following arguments are required: cmd
sherlock@ubuntutest:~$ bimmerconnected
-bash: /home/sherlock/.local/bin/bimmerconnected: No such file or directory
sherlock@ubuntutest:~$

Normally i was kind of sure that when you want to install package with pip3 you need to do sudo and then it is available for every user, but that does not work like that for this server (like one of my 10 VM's for development)

rikroe commented 1 year ago

Seems like the old alias for bimmerconnected is still pointing to the local installation. However no idea how to fix this.

xsherlockpl commented 1 year ago

Fixed that with proper $PATH pointing to /usr/local/bin instead /home/sherlock/.local/bin

it is always a hassle to remember how automation was done when it is 4y or so ago, and I only return to it once a year when BMW breaks something in their API.