bimmerconnected / bimmer_connected

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

F39/F30/G30/I01/F80 Fingerprints - 404 errors (5 vehicles) #185

Closed Glitch482 closed 4 years ago

Glitch482 commented 4 years ago

Describe the issue New install, experiencing limited access with numerous "Unavailable" or "Unknown" messages on features on most vehicles. X2 seems to be the only vehicle fully supported.

Only interested in integrating I3s features to Home Assistant.

Home Assistant version Home Assistant 0.110.6, fresh install pip3 install --upgrade bimmer_connected

Screenshots 2020-06-03 12 09 51 2020-06-04 13 17 36 2020-06-04 13 19 46 2020-06-05 14 13 29 2020-06-09 21 51 26

Connected Drive website

Your config.yaml

bmw_connected_drive:
  name_of_car:
    username: USERNAME_BMW_CONNECTED_DRIVE
    password: PASSWORD_BMW_CONNECTED_DRIVE
    region: north_america

Number of cars 18 i3s (I01/ID5) 17 530 (G30/ID5) 18 X2 ( F39/ENTRYNAV2) 18 M3 (F80/ID5) 18 M3 (F80/ID5)

Output of bimmer_connected fingerprint

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/token HTTP/1.1" 200 None
DEBUG:bimmer_connected.account:got new token [TOKEN] with expiration date 2020-06-09 08:03:06.105282
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[VEHICLE VIN]/status?deviceTime=2020-06-09T07%3A03%3A08&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:received new data from connected drive
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[VEHICLE VIN]/status?deviceTime=2020-06-09T07%3A03%3A09&dlat=0.0&dlon=0.0 HTTP/1.1" 404 None
DEBUG:bimmer_connected.account:The BMW Connected Drive portal returned an error: NOT_FOUND (received status code 404 and expected 200).
DEBUG:bimmer_connected.account:{"error":{"code":500,"description":"(SmartPhoneUtil-A-2012) Ressource not found. No status available for VIN [VEHICLE VIN]"}}
Traceback (most recent call last):
  File "/usr/bin/bimmerconnected", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/bimmer_connected/cli.py", line 223, in main
    args.func(args)
  File "/usr/lib/python3.8/site-packages/bimmer_connected/cli.py", line 116, in fingerprint
    account.update_vehicle_states()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 251, in update_vehicle_states
    car.update_state()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/vehicle.py", line 72, in update_state
    self.state.update_data()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/state.py", line 128, in update_data
    response = self._account.send_request(
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 170, in send_request
    raise IOError(msg)
OSError: The BMW Connected Drive portal returned an error: NOT_FOUND (received status code 404 and expected 200).

status_0.txt vehicles_0.txt

rikroe commented 4 years ago

Did it work before? Or did you just try it for the first time?

In general, the BMW APIs are not totally stable, I do get regular 404 or 403s as well. So please try out a couple of times or wait a day or two (what the HA component already does).

Additionally, there is a new version of the API (at least for rest_of_world) which could also cause issues. However we don't have a confirmation that it works for north_america as well.

If you want, you can try out our beta for the new API using pip3 install bimmer-connected==0.8.0.0b1 and then try running the fingerprint again.

rikroe commented 4 years ago

Another thing that came to me while looking through the list of vehicles: Is the VIN that throws the NOT_FOUND exception your F30 (so second car in vehicles) and does not support the connected drive services fully? AFAIK the 2012 F30 still hasa CCC and no NBT headunit, right?

If possible, could you remove the F30 from you ConnectedDrive account and test this?

Maybe we need to catch an exception gracefully somewhere or decide based on the data available in vehicles not to check the device status.

Glitch482 commented 4 years ago

Did it work before? Or did you just try it for the first time?

In general, the BMW APIs are not totally stable, I do get regular 404 or 403s as well. So please try out a couple of times or wait a day or two (what the HA component already does).

Additionally, there is a new version of the API (at least for rest_of_world) which could also cause issues. However we don't have a confirmation that it works for north_america as well.

If you want, you can try out our beta for the new API using pip3 install bimmer-connected==0.8.0.0b1 and then try running the fingerprint again.

Another thing that came to me while looking through the list of vehicles: Is the VIN that throws the NOT_FOUND exception your F30 (so second car in vehicles) and does not support the connected drive services fully? AFAIK the 2012 F30 still hasa CCC and no NBT headunit, right?

If possible, could you remove the F30 from you ConnectedDrive account and test this?

Maybe we need to catch an exception gracefully somewhere or decide based on the data available in vehicles not to check the device status.

Thanks for the quick reply!

I installed the original script a couple of weeks ago and have been troubleshooting in case it was something on my end, even reinstalling/restarting Home Assistant multiple times. What's weird is that the X2 seems to be fully working with ENTRYNAV2 (lower end NAV) and ID5 systems are crippled as seen in the screenshots. Unfortunately, I cannot remove vehicles from the ConnectDrive account.

Only interested in integrating the i3 to HA, just using the other vehicles as comparison/troubleshooting.

I'm running 0.8.0.0b1 currently and cannot get a fingerprint or status_0.txt or vehicles_0.txt output.

0.8.0.0b1 log output and status screenshots below.

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:bimmer_connected.account:getting new GCDM token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): customer.bmwgroup.com:443
DEBUG:urllib3.connectionpool:https://customer.bmwgroup.com:443 "POST /gcdm/usa/oauth/token HTTP/1.1" 200 None
DEBUG:bimmer_connected.account:got new GCDM token Q8dAhAgxlLVmpu3m4HFmDYYwa9AaVxVX
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): myc-profile.bmwusa.com:443
DEBUG:urllib3.connectionpool:https://myc-profile.bmwusa.com:443 "GET /api/Account/ExternalLogin?provider=GCDM&response_type=token&redirect_uri=https%3A%2F%2Fmyc-profile.bmwusa.com%2F&client_id=self HTTP/ 302 0
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://api.bmwgroup.us:443 "GET /gcdm/protected/%7BclientId%7D/%7BclientVariantId%7D/customers/userAccount?response_type=code&client_id=[=REMOVED=]&rect_uri=https%3A%2F%2Fmyc-profile.bmwusa.com%2Foauth_callback.html&scope=authenticate_user&state=[=REMOVED=] HTTP/1.1" 404 None
DEBUG:urllib3.connectionpool:https://myc-profile.bmwusa.com:443 "GET /oauth_callback.html?scope=authenticate_user&refresh=[=REMOVED=]&state=[=REMOVED=] HTTP/1.1" 400 0
DEBUG:urllib3.connectionpool:https://myc-profile.bmwusa.com:443 "GET /api/Account/ExternalLogin?provider=GCDM&response_type=token&redirect_uri=https%3A%2F%2Fmyc-profile.bmwusa.com%2F&client_id=self HTTP/ 302 0
DEBUG:urllib3.connectionpool:https://api.bmwgroup.us:443 "GET /gcdm/protected/%7BclientId%7D/%7BclientVariantId%7D/customers/userAccount?response_type=code&client_id=d766b537-a654-4cbd-a3dc-0ca5672d7f8d&rect_uri=https%3A%2F%2Fmyc-profile.bmwusa.com%2Foauth_callback.html&scope=authenticate_user&state=[=REMOVED=] HTTP/1.1" 404 None
Traceback (most recent call last):
  File "/usr/bin/bimmerconnected", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/bimmer_connected/cli.py", line 226, in main
    args.func(args)
  File "/usr/lib/python3.8/site-packages/bimmer_connected/cli.py", line 113, in fingerprint
    account = ConnectedDriveAccount(args.username, args.password, get_region_from_name(args.region),
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 61, in __init__
    self._get_vehicles()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 264, in _get_vehicles
    self._get_oauth_token()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 123, in _get_oauth_token
    self._oauth_token = oauth_tokens['access_token']
KeyError: 'access_token'

2020-06-10 19 13 32 2020-06-10 19 13 23

rikroe commented 4 years ago

Ok, then please go back to the non-beta version:

pip3 uninstall bimmer_connected
pip3 install bimmer_connected

I will try to see if I come up with a better error handling for this (maybe this weekend) so it doesn't stop at the first error but ignores it an continues. You could try to use the following code instead of (haven't tested it!) in account.py#L231:

        for vehicle_dict in response.json()['vehicles']:
            try:
                self._vehicles.append(ConnectedDriveVehicle(self, vehicle_dict))
            except:
                pass

Of course this needs much more refinement :D

Glitch482 commented 4 years ago

Ok, will give this a try tonight before reverting and follow up. Thanks!

Glitch482 commented 4 years ago

My L231entry in account.py was a bit different than what you are listing, so uninstalled 0.8.0.0b1 and went back to last version. If there's anything you'd like me to test, let me know.

rikroe commented 4 years ago

Sorry for being clear: the changes were supposed to go to the current stable version, so the one you downgraded to.

Glitch482 commented 4 years ago

Added the changed lines @ L231. Here's the fingerprint log, no status_0.txt or vehicles_0.txt output.

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/token HTTP/1.1" 200 None
DEBUG:bimmer_connected.account:got new token [=REMOVED=] with expiration date 2020-06-12 19:49:00.363373
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[= VIN REMOVED=]/status?deviceTime=2020-06-12T18%3A49%3A06&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:received new data from connected drive
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[= VIN REMOVED=]/status?deviceTime=2020-06-12T18%3A49%3A07&dlat=0.0&dlon=0.0 HTTP/1.1" 404 None
DEBUG:bimmer_connected.account:The BMW Connected Drive portal returned an error: NOT_FOUND (received status code 404 and expected 200).
DEBUG:bimmer_connected.account:{"error":{"code":500,"description":"(SmartPhoneUtil-A-2012) Ressource not found. No status available for [= VIN REMOVED=]"}}
Traceback (most recent call last):
  File "/usr/bin/bimmerconnected", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/bimmer_connected/cli.py", line 223, in main
    args.func(args)
  File "/usr/lib/python3.8/site-packages/bimmer_connected/cli.py", line 116, in fingerprint
    account.update_vehicle_states()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 254, in update_vehicle_states
    car.update_state()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/vehicle.py", line 72, in update_state
    self.state.update_data()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/state.py", line 128, in update_data
    response = self._account.send_request(
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 170, in send_request
    raise IOError(msg)
OSError: The BMW Connected Drive portal returned an error: NOT_FOUND (received status code 404 and expected 200).
rikroe commented 4 years ago

Please try to remove the break in account.py#L171 as well. Again sorry, this is being scratched on the go ;)

Glitch482 commented 4 years ago

break removed in account.py

Not sure if this matters or not, but the only VIN being polled is only the X2, I don't see the i3 VIN listed anywhere in the log.

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.                                                                                                                         us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/to                                                                                                                         ken HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.                                                                                                                         us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/to                                                                                                                         ken HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.                                                                                                                         us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/token HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/token HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/token HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/token HTTP/1.1" 200 None
DEBUG:bimmer_connected.account:got new token [=token removed=] with expiration date 2020-06-13 13:37:28.293474
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[=VIN REMOVED=]/status?deviceTime=2020-06-13T12%3A37%3A39&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[=X2 VIN REMOVED=]/status?deviceTime=2020-06-13T12%3A37%3A39&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/WBXYJ5C30JEF72408/status?deviceTime=2020-06-13T12%3A37%3A39&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/WBXYJ5C30JEF72408/status?deviceTime=2020-06-13T12%3A37%3A39&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/WBXYJ5C30JEF72408/status?deviceTime=2020-06-13T12%3A37%3A39&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[=X2 VIN REMOVED=]/status?deviceTime=2020-06-13T12%3A37%3A39&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:received new data from connected drive
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[=X2 VIN REMOVED=]/status?deviceTime=2020-06-13T12%3A37%3A44&dlat=0.0&dlon=0.0 HTTP/1.1" 404 None
DEBUG:bimmer_connected.account:The BMW Connected Drive portal returned an error: NOT_FOUND (received status code 404 and expected 200).
DEBUG:bimmer_connected.account:{"error":{"code":500,"description":"(SmartPhoneUtil-A-2012) Ressource not found. No status available for [=X2 VIN REMOVED=]"}}
Traceback (most recent call last):
  File "/usr/bin/bimmerconnected", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/bimmer_connected/cli.py", line 223, in main
    args.func(args)
  File "/usr/lib/python3.8/site-packages/bimmer_connected/cli.py", line 116, in fingerprint
    account.update_vehicle_states()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 253, in update_vehicle_states
    car.update_state()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/vehicle.py", line 72, in update_state
    self.state.update_data()
  File "/usr/lib/python3.8/site-packages/bimmer_connected/state.py", line 128, in update_data
    response = self._account.send_request(
  File "/usr/lib/python3.8/site-packages/bimmer_connected/account.py", line 170, in send_request
    raise IOError(msg)
OSError: The BMW Connected Drive portal returned an error: NOT_FOUND (received status code 404 and expected 200).
rikroe commented 4 years ago

The try/except block is still there? Then I need to look through it fully but cannot give you an eta. But I am pretty sure I know where the issue comes from 👍

Glitch482 commented 4 years ago

Maybe I'm misunderstanding a step? Here's a snippet of account.py with the changes made.

snip

rikroe commented 4 years ago

That looks how I imagined. Not sure why it doesn't work as expected...

rikroe commented 4 years ago

Could you please revert the changes?

Looking at your first logs and the code thoroughly it has nothing to do with the list of vehicles itself (i.e. vehicles_0.txt) but the vehicle state itself. Therefore we need the same logic in a different place.

Could you please try to change your state.py according to this: https://github.com/bimmerconnected/bimmer_connected/compare/master...rikroe:fix/exit_unsupported_vehicles and let me know if that works for you?

Glitch482 commented 4 years ago

bimmer_connected uninstalled and reinstalled. Changes made in state.py

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "POST /gcdm/oauth/token HTTP/1.1" 200 None
DEBUG:bimmer_connected.account:got new token [TOKEN REMOVED] with expiration date 2020-06-14 11:35:59.911916
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[X2 VIN REMOVED]/status?deviceTime=2020-06-14T10%3A36%3A01&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:received new data from connected drive
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[335 VIN REMOVED]/status?deviceTime=2020-06-14T10%3A36%3A02&dlat=0.0&dlon=0.0 HTTP/1.1" 404 None
DEBUG:bimmer_connected.account:The BMW Connected Drive portal returned an error: NOT_FOUND (received status code 404 and expected 200).
DEBUG:bimmer_connected.account:{"error":{"code":500,"description":"(SmartPhoneUtil-A-2012) Ressource not found. No status available for VIN [335 VIN REMOVED]"}}
DEBUG:bimmer_connected.state:Unable to retrieve vehicle status from connected drive
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[530 VIN REMOVED]/status?deviceTime=2020-06-14T10%3A36%3A03&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:received new data from connected drive
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[i3 VIN REMOVED]/status?deviceTime=2020-06-14T10%3A36%3A04&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:received new data from connected drive
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[M3 VIN REMOVED]/status?deviceTime=2020-06-14T10%3A36%3A05&dlat=0.0&dlon=0.0 HTTP/1.1" 404 None
DEBUG:bimmer_connected.account:The BMW Connected Drive portal returned an error: NOT_FOUND (received status code 404 and expected 200).
DEBUG:bimmer_connected.account:{"error":{"code":500,"description":"(SmartPhoneUtil-A-2012) Ressource not found. No status available for VIN [M3 VIN REMOVED]"}}
DEBUG:bimmer_connected.state:Unable to retrieve vehicle status from connected drive
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 "GET /webapi/v1/user/vehicles/[M3 VIN REMOVED]/status?deviceTime=2020-06-14T10%3A36%3A07&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:received new data from connected drive

fingerprint of the vehicles written to /root/vehicle_fingerprint/2020-06-14_10-35-59 status_0.txt status_1.txt status_2.txt status_3.txt vehicles_0.txt

rikroe commented 4 years ago

Great, that looks much better! If you're using this version in HA, you should see all relevant entities for all 4 cars except the F30.

Are you able to (un)lock/light flash/sound horn with the F30 from the BMW app?

Glitch482 commented 4 years ago

I am using Home Assistant 0.110.6. I only have access to the i3s, the other vehicles are with other people (different locations). I'm only interested in integrating the i3s, but can use the other vehicles for comparisons.

Values are still listed as "unavailable" in the i3s as in the earlier screenshots (same screenshot for reference, values unchanged). However, I am able to flash the headlights, operate locks/headlamps on the i3s from the official BMW connected app.

i3

rikroe commented 4 years ago

Where did you edit the state.py? If you edited the one installed in HA's python environment, it should work. You might need to restart HA.

However this is only a workaround until we've updated the package to PyPi.

Glitch482 commented 4 years ago

Where did you edit the state.py? If you edited the one installed in HA's python environment, it should work. You might need to restart HA.

However this is only a workaround until we've updated the package to PyPi.

I restarted HA earlier just to be sure - no changes. All changes have been using path /usr/lib/python3.8/site-packages/bimmer_connected/

Glitch482 commented 4 years ago

Made changes to state.py in /usr/lib/python3.8/site-packages/homeassistant_cli/plugins/ and restarted HA with also no changes in status.

rikroe commented 4 years ago

Mhh, as I use HA Core on Docker I don't know how that works exactly for you. I'll try to check how the changes work with the HA component tomorrow to see if we can safely use it from HA (or using a custom component as a workaround).

rikroe commented 4 years ago

@gerard33 could you help us out here?

As far as I can see nothing in the HA component should break if a single vehicle does not have a state (or rather an empty dict as state).

Is it possible to test this in HA without releasing a new version to PyPi?

gerard33 commented 4 years ago

I have tried to find the bimmerconnected library on my install (hassio) but can’t find it. I think (not checked) the path mentioned above is to the via pip installed version and not the one HA uses.

I think HA can indeed handle it if a vehicle doesn’t have a state (empty dict).

Easiest way to test the new code is with a custom component. It’s possible to make a folder in the component folder where you place the bimmerconnected library, but guess making the code changes for that in the custom component is more work than to push a beta version to Pypi. Maybe make the change to the 0.8.0b version so we have a test case for US at the same moment?

It’s also possible to make a link to a Github repo in the manifest.json, but that won’t save a lot of work I think.

Glitch482 commented 4 years ago

Appreciate the help, let me know what's needed to test on my end. Willing to go the custom component route if needed.

Glitch482 commented 4 years ago

Just went ahead and installed HACS and bmw_connected_drive beta version 20200511.2 if that's any easier to troubleshoot. No change in status on i3. hacs_bmw

hacs_card

gerard33 commented 4 years ago

Once #187 is merged and a new version of the custom component is made, you can use that version to see if the issue is fixed. The version you have used now doesn't contain the fix yet.

rikroe commented 4 years ago

Please try to install release 20200617.1 20200617.2 of the custom component and try that out!

gerard33 commented 4 years ago

Small update made in the custom component. Please use version 20200617.2.

Glitch482 commented 4 years ago

Small update made in the custom component. Please use version 20200617.2.

Installed 20200617.2 and starting to get some activity on the i3: i3s_card

gerard33 commented 4 years ago

That looks good. The other cars are also showing data now (except the F30)?

Glitch482 commented 4 years ago

All seems to be working, thanks for your and @rikroe's help. Here's some screengrabs of the cards, the F30 will only show lock state. Don't worry about M3 Firmware: WBS8M9C56JXXXXXXX, as the car was totaled in an accident earlier this year. the other M3 seems to be communicating fine.

Let me know if you need any other areas tested.

335 530 M3-1 M3-2 X2

gerard33 commented 4 years ago

Good to see it's working now. We will make a PR for HA so it get's fixed in the official integration as well.