Audi MMI support

ok, gonna disable it , seems i have the issue back, see here below, only have it with this component loaded

2019-11-05 16:06:48 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] HTTPSConnectionPool(host='msg.audi.de', port=443): Read timed out. (read timeout=10)
2019-11-05 16:06:48 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] API error: {'errorCode': 'batterycharge.auth.forbidden', 'description': 'The service: rbatterycharge_v1 for VIN: WAxxxxx could not be found.'}
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of person is taking over 10 seconds.
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of input_select is taking over 10 seconds.
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of google_keep is taking over 10 seconds.
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of google is taking over 10 seconds.
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of python_script is taking over 10 seconds.
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of asuswrt is taking over 10 seconds.
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of updater is taking over 10 seconds.
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of ffmpeg is taking over 10 seconds.
2019-11-05 16:06:49 WARNING (MainThread) [homeassistant.setup] Setup of input_boolean is taking over 10 seconds.
2019-11-05 16:06:49 ERROR (MainThread) [homeassistant.components.deconz] Error connecting to deCONZ gateway at 172.30.32.1

Do you have an eTron? If not, then don’t worry. Your car cannot report battery charge if you do not have a battery that reports it.

no etron here , ok, i can ignore it then
but i have disabled the component for now again

Thanks for trying it out. I simply added a timeout of 10 seconds, but it seems HA is starting up various components at the same time and when the audi components blocks for 10 seconds it messes up various other components initialisation.

To fix this, the audiAPI library needs to support async. As I don’t think the library is actively maintained anymore, I’ll integrate the library into this component and rewrite it to be async and behave within HA. I’ll see what I can do over the weekend and get back to you.

Thnx for looking into this! Appreciate it, it’s a cool component to integrate for show off :wink:

I’ve overridden the required functions in the audiAPI library to be async. The component now seems to start in the background as it is supposed to do. Let me know if you have further issues. If the component is stable I’ll add config flows and HACS support.

Cheers

ok, loaded new version again
have to wait for some days now
cause sometimes, i dont see the errors only on reboot hassio, but just after days, things are crashing , websocket issues … is that also because of the async?

it happened again this night, noticed my deconz was dead again
disabled audiconnect for now

i dont see errors though in the log file, can i debug this component?

Well if that is still caused by the Audi component I’m out of ideas. The component should at least print out a message when a timeout or such occurs. Are you sure the Audi component is the cause?

In my tests the component is neatly running in the background, timeouts are handled, etc. I have various components running next to the Audi component, including two deconz instances, and I have no problems at all

not 100% sure, but my system was 2 weeks stable when i commented out audi
now , its back unstable … but i have no clue either

is it possible to enable debug on this component?

It’s this working only for etron? I have an Audi A3 with MMI plus, can be used with this? i tried the module but does not work :frowning:

It should work, do you have an Audi connect account? Do you see the state of your car on the website?

I can see my car but not more data :frowning: I just got it and I’m Having MMI plus with touch, but I suppose to have internet (no sim card port tho) but funny I can see “traffic” (closed roads) but in the main screen menu i dont see “audi connect” or “internet” :frowning: so I guess i don’t have it right?
The model it’s 2016

Home Assistant can do no magic here. It just displays what also can be seen on my.audi.com. And car data will only be available there if your car is equipped with Audi connect. This requires a SIM card slot in card up to MY 2016 (or something like that) or a built-in eSIM.

1 Like

Thank you Thomas and Arjen for making this. I am rather new to Hassio/HA. When doing like you describe here downloading the repo and extracting it under custom_components, I do get an error about missing AudiAPI. I have found that in GitHub and copied the files, but still get the error :
2019-11-13 20:55:55 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.audiconnect. Make sure all dependencies are installed
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/loader.py”, line 346, in _load_file
module = importlib.import_module(path)
File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/config/custom_components/audiconnect/init.py”, line 9, in
from audiapi.Services import Service, RequestStatus
ModuleNotFoundError: No module named ‘audiapi’

hi, just reboot your system, it will be installed on next reboot

Thank you. Two restarts and it worked :smile:

@arjenvr, not that I really care, but it would be kind of nice/clean if the Audi component were maintained outside the project. That would make is usable by other projects that wants your improved version. Who knows, you may find others that want to help you improve the component over time from other projects.

I will get my new Audi on Monday. It will be very nice to try out your component.

Hi,
First: Great effort @arjenvr!

Own an Audi A3 e-tron PHEV, and are really interested in this component iot control my car more seamless. My biggest wish is the climate control. As for now, i would have to manually set the timer every day in the myAudi-app.

Had a look at the component, and I’ve made the get-part of it working. Do anyone have the documentation of the API, or know how to set ut the commands?

Or have somebody clues how to make some reverse-engineering of the myAudi-app?

Hi @andersop91

There is no API documentation that I am aware of. Car manufacturers currently do not seem to be keen on 3rd party integration…

There are basically two ways to reverse-engineer the app:

  • Decompile it using tools such as apktool and dex2jar
  • Use mitmproxy to capture the traffic of the app (requires swapping the embedded root certificate of the apk with your own and as such, root access)

Regards
Arjen