Audi MMI support

I have it set to update once every 10 minutes and it works without problems.

Note that this is an update from the platform, not the car. You can trigger an update from the car from within Hassio (there is a service for it) but that is limited in some ways. If you do it too many times, the car will stop responding (the Audi app indicates that it is to conserve battery…) But I find that on major changes the car informs the platform anyway so there hardly is any need to force an update.

Thomas

A new version has been commited:

  • Added service calls to start/stop the charger (seems to be working when not controlled by timer?)
  • Added checking of the request status after an action: sending the command to perform an action in the car, the API returns an action Id, which is used in successive calls to check if the car was able to perform the action. This takes a while, as this requires communicating with the car and waiting for the car to process the command.
  • Climatisation seems to work for some, but for instance @thomas-be is getting an error 9 when checking the request status (whatever that means). The good news is that the API calls for the charger and climatisation have been verified and seem to be correct.
  • The integration now automatically triggers a vehicle data refresh request after an action completed successfully (such as locking, climatisation, etc)
  • Added sensors for primary/secondary engine range, hybrid range, charging power, and charging rate

hmmm, updated with HACS , now this error:

2020-01-22 12:16:47 ERROR (MainThread) [homeassistant.setup] Setup failed for audiconnect: Unable to import component

@pergola.fabio Wow that was fast. Please try again, added a missing file

working again, also FAST :slight_smile:

Indeed it stll does not seem to work for my car :frowning:, but I understand this may be one of the limitations of reverse engineering the API. I added the log as an issue in github just in case.

UPDATE: since the last changes I can now turn the climate “off”, but not “on”. Is there anyone else here who owns an e-Tron who can confirm if this is related to the model or there may be an issue in my personal car settings?

Thomas

My car a Audi Q5 TFSI e (Hybrid. With the latest version i can turn the climate “off” and “on” without problems :+1:

Thanx for the integration

Could it be that it requires another source?
Check https://github.com/arjenvrh/audi_connect_ha/pull/17

I own an Audi A3 e-tron plug-in hybrid, and only ‘electric’ works as source for my car. That is also what i proposed in the pull-request. But there is also a an ‘automatic’ option i believe…

1 Like

If I can find this in the code I will do a quick check. Otherwise always willing to open up my car app to @arjenvr again so he can do the test :slight_smile:

Hi Thomas,
I already tried the “automatic” setting during testing with your car, unfortunately it didn’t work.

Would it be possible to have the climatisation added as a switch?
To make it clearer, this is how looks for my Volvo.

Got one switch for preheating/climatisation, and one for engine start, which I’m a bit disappointed at Audi for not supporting.
Have gotten climatisation to work via script, but this would make it much more user friendly.

1 Like

Is it me only or integration stopped to work after upgrade to 0.105.2? All sensors are unavailable… After triggering manual update (audiconnect.refresh_vehicle_data) I get bunch of errors in the log file:

2020-02-08 17:44:25 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (MySQLdb._exceptions.DataError) (1406, "Data too long for column 'event_type' at row 1")
[SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id) VALUES (%s, %s, %s, %s, %s, %s, %s)]
[parameters: ('audiconnect_refresh_vehicle_data_completed', '{"vin": "w..........2"}', 'LOCAL', datetime.datetime(2020, 2, 8, 16, 44, 25, 329840, tzinfo=<UTC>), datetime.datetime(2020, 2, 8, 16, 44, 25, 333449), '83e3a3b93e3e4262adb699d4097e41aa', None)]
(Background on this error at: http://sqlalche.me/e/9h9h)
2020-02-08 17:44:25 ERROR (Recorder) [homeassistant.components.recorder] Error saving event: <Event audiconnect_refresh_vehicle_data_completed[L]: vin=wauzzzfy1h2040292>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/usr/local/lib/python3.7/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.DataError: (1406, "Data too long for column 'event_type' at row 1")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 348, in run
    session.flush()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2479, in flush
    self._flush(objects)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2617, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 153, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2577, in _flush
    flush_context.execute()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
    rec.execute(self)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute
    uow,
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj
    insert,
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 1137, in _emit_insert_statements
    statement, params
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 982, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 293, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement
    distilled_params,
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1250, in _execute_context
    e, statement, parameters, cursor, context
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1476, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/usr/local/lib/python3.7/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
sqlalchemy.exc.DataError: (MySQLdb._exceptions.DataError) (1406, "Data too long for column 'event_type' at row 1")
[SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id) VALUES (%s, %s, %s, %s, %s, %s, %s)]
[parameters: ('audiconnect_refresh_vehicle_data_completed', '{"vin": "w..................2"}', 'LOCAL', datetime.datetime(2020, 2, 8, 16, 44, 25, 329840, tzinfo=<UTC>), datetime.datetime(2020, 2, 8, 16, 44, 25, 333449), '83e3a3b93e3e4262adb699d4097e41aa', None)]
(Background on this error at: http://sqlalche.me/e/9h9h)

OK, got it sorted out… Apparently after upgrade to 0.105.2 all entities were recreated witch changed name, so I found 2 sets of these in integration configuration:


Removing unavailable entities and updating lovelace cards to new ones did the trick.
The question is why the new one were created and how to avoinf it in the future… I’d prefer not to reconfigure ingration every time upgrade is doen :slight_smile: Any idea of what happened?

I didn’t happen here on my upgrades

Mine randomly changes sometimes, it will have sedan in it’s name and then sometimes it will say limousine. Another reboot and it goes back (I forget which is the one it normally is). I am in the US by the way.

Hi. I have installed the custom component since HACS. I have restarted.
Now I go to Configuration-> Integrations, click + and search for and Audi Connect doesn’t appear

Should I do something else?

HA (core) 0.105.3

Is it loading, is it visible in the log file ?

Yes, it’s loading

“WARNING (MainThread) [homeassistant.loader] You are using a custom integration for audiconnect which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.”

EDIT: Installing from HACS has not worked for me

Doing the manual installation has worked for me

Audi Connect integration was working fine for a while now and since updating HA to 0.106 and 0.106.1 it is failing to login.

2020-02-28 09:05:53 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Login to Audi service failed, trying again in 10 seconds
2020-02-28 09:06:09 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Unable to obtain the vehicle status report of …: 504, message=‘Gateway Timeout’, url='https://msg.volkswagen.de/fs-car/bs/vsr/v1/Audi/US/vehicles/.../status
2020-02-28 09:06:09 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Unable to update the vehicle position of …: 504, message=‘Gateway Timeout’, url='https://msg.volkswagen.de/fs-car/bs/cf/v1/Audi/US/vehicles/.../position

I know when I go to the audi site directly and login to MyAudi it’s fine.