Mercedes Me Component

you can use this component

It where @ReneNulschDE who wrote it in comments of the release of 0.63, with the Google Geocode I guess I can get the addresses but still Im looking to get the full trips. This since I need to collect this data for the company car and I see this feature as great tool of automation :slight_smile:

Hi Jef,

Iā€™m focussing currently on

  1. the integration of cars registered in the US
  2. better handling of scenarios where you own more than one car.
  3. add additional sensors
  4. add a switch for heating
  5. add a lock switch
  6. Try to understand the ODB connector

Please give me some time to implement the important stuff and then Iā€™ll try to solve the described challenge.

Thx
Rene

I have added the requested sensors to the beta repo.

The name option is not optimal because you can have more than one car. My plan is to add the license plate to the sensor name.

What do you think about this?

Good idea about adding the license plate to the sensor name, makes it unique and easy to identify.
Iā€™ll test it later and keep you updated whenever any issue arises.

The beta repo contains a new version.

This is a breaking change. The sensors and binary sensors have the license plate in the name now. This makes it easier to handle multiple cars.

I have a Mercedes ME enabled car as well would love to see this working, let me know what I can do.

Hi,

I finally took the time to set this up, I have 0.65.5 of HA installed. But I do get below issue, any ideas on what this could be?

Mon Mar 19 2018 15:52:18 GMT+0100 (W. Europe Standard Time)

Error during setup of component mercedesme

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.5/socket.py", line 576, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 937, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 799, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 583, in read
    v = self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/util/retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.5/socket.py", line 576, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 937, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 799, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 583, in read
    v = self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 145, in _async_setup_component
    component.setup, hass, processed_config)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mercedesme.py", line 73, in setup
    mercedesme_api = Controller(username, password, scan_interval)
  File "/srv/homeassistant/lib/python3.5/site-packages/mercedesmejsonpy/controller.py", line 44, in __init__
    self.session_cookies = self._get_session_cookies(username, password)
  File "/srv/homeassistant/lib/python3.5/site-packages/mercedesmejsonpy/controller.py", line 81, in _get_session_cookies
    loginpage = session.get(LOGIN_STEP1_URL, verify=LOGIN_VERIFY_SSL_CERT)
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

Hi, looks like this is a problem with the MB servers or they have changed the endpoint. I see this error too for 9 out of 10 requests. Iā€™ve restarted my hass 5 times and 3 times I received some data from MB. Could you click on this url and check if you get some json after logon?

They show outdated data currently. Iā€™m sure my car was refilled on Saturday and the API shows near to empty. I have to check the app.

Hi, sorry for the late response. I was on a business trip in asia. In what region do you live? Do you have a Mercedes ME adaptor or car integrated?

Looks like they have disabled/problems with the latestTrip also. It is not delivered in the api response anymore.

Car integrated.

Hi, I have no good news for the mercedes me component. Mercedes has changed the API interface completely and Iā€™m not sure if I could solve this. MB is working on a new API for App-developers but also this API is in demo mode only.

Sorry to say, but it looks like an end at least for next couple of months.

Hi,

It is actually working for me when I tried now. Did a reboot of hass and it gives me data.

Even if they do a new API. I guess they wont ditch the old API until new is up and rolled on all clients (ios etc)ā€¦

Maybe this post from @touliloup can be helpful.

1 Like

Thank you, I saw this. The API is experimental with demo cars only. I asked the dev-team for a time plan but got no response.

they are using the new api in their app, but an external access is not possible. the old one is accessible but the data is not refreshed.

Hi, Iā€™m playing with the new experimental API from Mercedes. Currently, only Demo-Cars are available.

  • New OAuth --> works
  • Getting car details --> works

I hope Mercedes will publish a Beta release with real cars soon.

Great news! Iā€™m still having hopes, Iā€™m keeping my ā€œInvalid config: mercedesmeā€ in my HA dashboard :slight_smile:

Would be great to see possibility to turn car heater on. Their original app was loosing log on info at beginning , then it was impossible to log on at all. Guy at the garage suggested to uninstall app and use web interface instead. But it just that it takes 45 seconds until I get to the right place to start heater and then 2-5 attempts to turn it on with 10-15 sec waiting time between each. So annoying, since I do that every morning (live in Norway). I wish I could just tap one button and let the rest to be handled by home assistant (Turn on / check status: if not then turn on againā€¦)