Audi MMI support

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.

Today and yesterday I’ve been trying to get this integration working, but no matter what I do I seem to be getting the invalid credentials error when adding the integration. I know the email and pw is correct. I don’t know if the S-pin is the 4-digit pin configured or the 8-pin found in the Audi app? Tried both.
If I do not enter S-pin I get the error User input malformed: expected str for dictionary value @ data[‘spin’].
I tried removing the integration from hacs several times.
I even tried adding a new user on my.audi.com, but it’s just the same.
Any suggestions?

I see fversteegen and lauff reports problem also. May it is broken for everyone at the moment?

It looks that Audi has changed details (mentioned client_id but could be also user-agent and other stuff). I tried to extract those details yesterday from new app but I do not have much time and knowledge to do that. What I found is that one of client_ids is f4d0934f-32bf-4ce4-b3c4-699a7049ad26@apps_vw-dilab_com but replacing it in the code hasn’t changed anything. I belive that the biggest issue is that Audi is (properly and securely) using SSL pinning…

A new 4.14.0 app was released a few days ago. Maybe the 4.9.2 was deactivated on the server with the new release? Then a new xqmauth_secret probably is needed?
I guess some of the experts here probably know how to adapt the code for the updated version.

Works again. Probably caused by some issues on VW side.

yeah, now I got it working. (works only with no S-pin or 8-digit pin for me)

Its working again at my end. I am using the 4 digit pin

Just installed and linked my Q4 but I only got 2 entities

  • sensor.audi_q4_e_tron_model
  • lock.audi_q4_e_tron_door_lock

2022-12-28 19:50:35.401 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] support_status_report set to False: 502
2022-12-28 19:50:35.546 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Unable to obtain the vehicle shortTerm tripdata of WAUxxxxxxx: 403, message=‘Forbidden’, url=URL(‘https://mal-1a.prd.ece.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/WAUxxxxxxx/tripdata/shortTerm?type=list&from=1970-01-01T00:00:00Z&to=2022-12-28T20:20:35Z’)
2022-12-28 19:50:35.694 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Unable to obtain the vehicle longTerm tripdata of WAUxxxxxxx: 403, message=‘Forbidden’, url=URL(‘https://mal-1a.prd.ece.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/WAUxxxxxxx/tripdata/longTerm?type=list&from=1970-01-01T00:00:00Z&to=2022-12-28T20:20:35Z’)

In the audi_api is see the following headers:

  • HDR_XAPP_VERSION = “4.13.0”
  • HDR_USER_AGENT = “myAudi-Android/4.13.0 (Build 800238275.2210271555) Android/11”

From the android/web it’s working ‘fine’
Anyone an idea/suggestion how to troubleshoot?

Does anyone know how I can modify username and PIN for an existing installation?

Simply remove the integration and re-add it. Entities will keep the same names (at least it did at my end)

1 Like

I have a 21 etron and have been working on setting up a toggle to start the climate control. When I run start_climatisation it starts the climate control but not the heated/cooled seats. Is there a call that will do both like I can from the Audi app?