core: bmw_connected_drive - 403 Quota Exceeded

The problem

Seems that BMW has limited the amount of queries you can do to their API, as it’s now throwing a 403 with a “Quote Exceeded” message making all the sensors unavailable.

What version of Home Assistant Core has the issue?

2022.9.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

bmw_connected_drive

Link to integration documentation on our website

https://www.home-assistant.io/integrations/bmw_connected_drive/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-09-19 19:43:30.442 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-XXXX@XXXX.com data: Error communicating with BMW API: Client error '403 Quota Exceeded' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles'
For more information check: https://httpstatuses.com/403
2022-09-19 19:53:36.015 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-XXXX@XXXX.com data: Error communicating with BMW API: Client error '403 Quota Exceeded' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles'
For more information check: https://httpstatuses.com/403
2022-09-19 20:13:40.208 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-XXXX@XXXX.com data: Error communicating with BMW API: Client error '403 Quota Exceeded' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles'
For more information check: https://httpstatuses.com/403
2022-09-19 20:28:44.379 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-XXXX@XXXX.com data: Error communicating with BMW API: Client error '403 Quota Exceeded' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles'
For more information check: https://httpstatuses.com/403
2022-09-19 20:58:47.330 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-XXXX@XXXX.com data: Error communicating with BMW API: Client error '403 Quota Exceeded' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles'
For more information check: https://httpstatuses.com/403
2022-09-19 21:13:50.213 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-XXXX@XXXX.com data: Error communicating with BMW API: Client error '403 Quota Exceeded' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles'

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 10
  • Comments: 84 (18 by maintainers)

Most upvoted comments

Can confirm, thanks for the report. Could be a temporary configuration thing at BMW or a very deliberately one. I’ll see if I find some time to debug this tomorrow.

After using 2022.9.6 it for almost 48 hours, the 5 minute polling interval continues to work for me.

However I am thinking about adding a paragraph for custom polling intervals to the docs.

@Cebeerre can you please close this issue?

The integration currently uses a 5 minute polling interval (see bmw_connected_drive/coordinator.py#L19).

If that doesn’t work for you, it can always be changed. However the last change seemed help, as apparently only the “list vehicles” endpoint has such a strict quota - that may change in the future of course.

Otherwise @Zixim’s automation (https://github.com/home-assistant/core/issues/78792#issuecomment-1255926045) can always be used to fine-tune the polling interval (disabling the global polling of course). Also you can do much more, depending on car location, charging status etc.

I confirm that to refresh ALL sensors, you just need to update one.

No, it will always update the complete integration config entry, i.e. the full account with all vehicles.

People using the Viessmann Vicare HA integration have been running into the same problems. Viessmann are rate limiting the API :

The Viessmann API is rate-limited. If you exceed one of the limits below you will be banned for 24 hours:

Limit 1: 120 calls for a time window of 10 minutes
Limit 2: 1450 calls for a time window of 24 hours

Exceeding the limits will (temporarily) break the integration as well as the official Viessmann mobile app. The most elegant solution is to disable the polling in the integration settings, and then make an automation that handles the polling. On a schedule that is convenient for you.

Using this same idea on the BMW Connected Drive has been working just fine for me.

I’m using 2 automations to handle the polling (as I am with my Vicare setup) :

  • one for day-time updates, from 07:00:00 to 23:59:00 which refreshes every 15 minutes.
  • one for night-time, from 00:00:00 to 07:00:00 which refreshes every hour.

The reasoning for 2 different frequencies is pretty obvious, when I’m asleep idgaf about having fresh data. And it creates a bit of a buffer during the daytime, for app usage.

This comment is getting a little long, I’ll just drop my automation for daytime refreshing :

automation:
  - id: f55447ea79875126
    alias: update_ix3_stats_day
    description: Update BMW ix3 entities every 15 minutes
    initial_state: on
    trigger:
      - platform: time_pattern
        minutes: /15
    condition:
      alias: "Time 0700~2359"
      condition: time
      after: "07:00:00"
      before: "23:59:00"
    action:
      - service: homeassistant.update_entity
        data:
          entity_id: sensor.ix3_m_sport_charging_status
          # updating 1 sensor causes all of them to be updated
    mode: single

PS: Not documenting the exact limits is a bit of a dick move by BMW, but I can understand…since they aren’t endorsing public API usage (which is also a dick move 😛 ).

I’m doing something similar:

Update every hour under normal conditions and every 15 minutes while charging, because I like to keep the batteries under 80 maximum SoC and BMW removed the ability in iDrive for my PHEV. I detect if the vehicle is charging and turn on/off the power with a smart socket.

People using the Viessmann Vicare HA integration have been running into the same problems. Viessmann are rate limiting the API :

The Viessmann API is rate-limited. If you exceed one of the limits below you will be banned for 24 hours:

Limit 1: 120 calls for a time window of 10 minutes
Limit 2: 1450 calls for a time window of 24 hours

Exceeding the limits will (temporarily) break the integration as well as the official Viessmann mobile app. The most elegant solution is to disable the polling in the integration settings, and then make an automation that handles the polling. On a schedule that is convenient for you.

Using this same idea on the BMW Connected Drive has been working just fine for me.

I’m using 2 automations to handle the polling (as I am with my Vicare setup) :

  • one for day-time updates, from 07:00:00 to 23:59:00 which refreshes every 15 minutes.
  • one for night-time, from 00:00:00 to 07:00:00 which refreshes every hour.

The reasoning for 2 different frequencies is pretty obvious, when I’m asleep idgaf about having fresh data. And it creates a bit of a buffer during the daytime, for app usage.

This comment is getting a little long, I’ll just drop my automation for daytime refreshing :

automation:
  - id: f55447ea79875126
    alias: update_ix3_stats_day
    description: Update BMW ix3 entities every 15 minutes
    initial_state: on
    trigger:
      - platform: time_pattern
        minutes: /15
    condition:
      alias: "Time 0700~2359"
      condition: time
      after: "07:00:00"
      before: "23:59:00"
    action:
      - service: homeassistant.update_entity
        data:
          entity_id: sensor.ix3_m_sport_charging_status
          # updating 1 sensor causes all of them to be updated
    mode: single

PS: Not documenting the exact limits is a bit of a dick move by BMW, but I can understand…since they aren’t endorsing public API usage (which is also a dick move 😛 ).

To give you a quick update: the chagnes from 2022.9.6 enable me to poll every five minutes, starting yesterday morning 9:00 UTC+2 until now without any issues.

We’ll see how long that will work 😃

Another idea that just came to my mind: At each refresh, we are currently calling at least 3 endpoints: 2 for basic vehicle information (one for BMW, one for MINI, e.g. here) and the actual vehicle state which is what is most interesting to us. The MyBMW also always calls both endpoints.

Maybe we can skip reloading the vehicles endpoint at every polling cycle and just call it at first execution, reducing the number of calls by two thirds.