Audi MMI support

I’m getting the same longterm/shortterm errors as @mirekmal but there are no entities for any type of trip data in my instance of the integration.

Assuming something isn’t broke in the code specifically, guessing maybe the integration isn’t determining what data a particular vehicle reports and trying to query things that aren’t there? Or maybe it’s regional? Like do certain countries have privacy issues around this kind of data so don’t report?

Just got this loaded up for my 2021 Audi Q5e. I’m only seeing locking/unlocking control available. Any help getting Climatisation and Charging controls available would be amazing. Happy to help out with any development/testing as well!

Edit: Realized these were services, not devices. Would be nice to be able to set scenes for preheating or controls from the GUI. But still grateful! Got everything working through scripts now.

Just updated my HA instance to 2022.6.6 from 2022.6.5 so minor. Noticed my Audi card is giving Unavailable for everything. Logs showing:

Login to Audi service failed: ‘access_token’

8:11:15 PM – (ERROR) Audi Connect (custom integration) - message first occurred at 6:36:43 PM and shows up 10 times

some more details:

Logger: custom_components.audiconnect.audi_connect_account
Source: custom_components/audiconnect/audi_connect_account.py:89
Integration: Audi Connect
First occurred: 6:36:43 PM (10 occurrences)
Last logged: 8:11:15 PM

Login to Audi service failed: 'access_token'

Any thoughts?

1 Like

May be the only one in the US for reference with this issue but I removed AudiConnect and added it back in and keeps saying invalid credentials. Tried logging into Audi’s website and not the fastest thing but did work.

Not only in US and not alone… Since few days I have same problem with my installation and I’m from Poland… Here is integration log:

Login to Audi service failed: 'access_token'
11:57:14 – (ERROR) Audi Connect (custom integration)
Login to Audi service failed, trying again in 10 seconds
11:57:03 – (ERROR) Audi Connect (custom integration) - message first occurred at 11:56:52 and shows up 2 times

And homeassistant log:

2022-06-16 11:57:03 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Login to Audi service failed, trying again in 10 seconds
2022-06-16 11:57:14 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Login to Audi service failed: 'access_token'

After two tries to get this to work reliably, I give up. The utility of it isn’t worth the time spent on it to get it working. I suspect it’s more on Audi’s side that is casuing the issue, but to me this was only a “neat to have” feature, and not essential. The (very) few times I’m not actually near my car, I’ll use the Audi app directly.

Yeah exact same thing for me. Cards in my HA stopped updating/functioning. So I removed the component from HACs and tried to restart from scratch, but now it says “invalid credentials” when I try to login.
I thought it was due to something that happened at the dealer, because I took the car to the dealer for its 1 year service and HA updated on the same day/timeframe, but I don’t think thats the case.

Probably something on the Audi side changed, because even the Audi website that I used to log onto (through the laptop) is now a different site; it fails the login and then redirects me to another site.

Not sure I’ll use it much but what made me interested outside the cuteness of this, was the ability to lock and unlock the door from HA. My family knows the app and having a way for them to unlock the door if they get to the car first say leaving the grocery store and can unlock it with the phone, cool bonus. Things that get people to engage with the app and not think HA is a man toy. :slight_smile:

Same here. Don’t see any issue in github so I assume it isn’t the same for everyone? Also tried to remove and re-add but also get “invalid credentials”

Edit: Created issue - "Invalid credentials" again · Issue #147 · arjenvrh/audi_connect_ha · GitHub

Been having the same issue here. Tried reinstalling etc but nothing works:

Logger: custom_components.audiconnect.audi_connect_account
Source: custom_components/audiconnect/audi_connect_account.py:89
Integration: Audi Connect
First occurred: 5:59:38 PM (1 occurrences)
Last logged: 5:59:38 PM

Login to Audi service failed: 'access_token’

The fix is not merged yet, update yourself and it will work again.

Updated the two affected files, enabled and reloaded the integration, and it’s working! (at least for now :slight_smile:
Thanks!!

Anyone have the fixes specifically? For some reason every link on that page I click on comes back with 0 files found or something like that.

Here’s the info I used:

Pull Request:

Commit Diff at:

I just copy and pasted the changes shown in the diff for audi_api.py and audi_services.py.

To custom_components/audiconnect/audi_api.py:

class AudiAPI:
  -  HDR_XAPP_VERSION = "4.6.0"
  -  HDR_USER_AGENT = "myAudi-Android/4.6.0 (Build 800236847.2111261819) Android/11"
  +  HDR_XAPP_VERSION = "4.9.2"
  +  HDR_USER_AGENT = "myAudi-Android/4.9.2 (Build 800237696.2205091738) Android/11"

    def __init__(self, session, proxy=None):
        self.__token = None

To custom_components/audiconnect/audi_services.py:

raise Exception("Cannot {action}, operation timed out".format(action=action))

  - # TR/2022-02-17: New secrect for X_QMAuth
  + # TR/2022-06-15: New secrect for X_QMAuth
    def _calculate_X_QMAuth(self):
        # Calcualte X-QMAuth value
        gmtime_100sec = int(
            (datetime.utcnow() - datetime(1970, 1, 1)).total_seconds() / 100
        )
  -     xqmauth_secret = bytes([55,24,256-56,256-96,256-72,256-110,57,256-87,3,256-86,256-41,256-103,33,256-30,99,103,81,125,256-39,256-39,71,18,256-107,256-112,256-120,256-12,256-104,89,103,113,256-128,256-91])
  +     xqmauth_secret = bytes([256-28,120,102,55,256-114,256-16,101,256-116,256-25,93,113,0,122,256-128,256-97,52,97,107,256-106,53,256-30,256-20,34,256-126,69,120,76,31,99,256-24,256-115,6])
        xqmauth_val = hmac.new(
            xqmauth_secret,
            str(gmtime_100sec).encode("ascii", "ignore"),
            digestmod="sha256",
        ).hexdigest()

  -     return "v1:55f755b0:" + xqmauth_val
  +     return "v1:c95f4fd2:" + xqmauth_val

    # TR/2021-12-01: Refresh token before it expires
    # returns True when refresh was required and succesful, otherwise False

Save changes and restart HA.

New version of integrtion is now available on HACS with fix for this issue! Works perfectly fine!

I have an e-tron, and if I restart Home Assistant while the car is not charging, the entities “Charging power” and “Charging rate” will not be created and their values are set to “unknown”. To fix his, I have to start charging the car and then restart Home Assistant again. Otherwise, the entities will not show up.

Is there a way to avoid this, other than always making sure the car is charging when I restart Home Assistant?

I do not have an e-tron, but a TFSIe. I do not have a “charging power” or " charging rate", rather a “charging state” and a “charging mode”. And these are always set properly, also when restarting HA.

While I have does parameters on the wallbox…

By the way, I really like this integration! :slight_smile:

Unfortunately since a few days the integration stopped working. In the logs I get “Login to Audi service failed: ‘client_id’”

Any thoughts on how to solve this?

I got the same issue yesterday.
I installed the integration two days before, and it worked. Then (yesterday) I manually (in the config file) entered the S-PIN (that I forgot to enter initially) and restarted HA. I first thought that these was the reason, but now (after fversteegen) reports the error, anything else might have changed.