Mercedes Me Component

Hi, send you a message. the complete file is fine.

I see the following options currently:

electricRangeKm
electricChargePercent
electricChargingStatus
electricConsumptionReset
electricConsumptionStart
distanceElectricalStart
distanceElectricalReset

You can click on my name and then the message icon.

Hi,

I’ve created a beta version of the Mercedes Me connector as a custom component. So its easier to show/test upcomming changes.

If you would like to test/use, the code is published here on Github

Whats new?

- new sensors
    electricRangeKm
    electricChargePercent
    electricChargingStatus
    electricConsumptionReset
    electricConsumptionStart
    distanceElectricalStart
    distanceElectricalReset

- new binary sensors
    warningWashWater
    warningBrakeFluid
    warningEngineLight

Configuration:

mercedesmebeta:
  username: email
  password: password
1 Like

Installed the beta version successfully no issue to report so far.
would it be possible to add name to the main sensor to easily identify/group them

sensor.mycar.xxxx

mercedesmebeta:
name: mycar
username: email
password: password

Can you also add the following sensor if possible:
“trunkClosed”: true
“trunkLocked”: true
“fuelLidClosed”: true
“warningBrakeLineWear”: false
“warningCoolantLevelLow”: false
“tireWarningLight”: “INACTIVE”,
“parkingBrakeStatus”: true
“lightSwitchPosition”: “AUTO”,
“tankReserveLamp”: false,

Hi,

I’m very intrested in this feature:

Example: select state, attributes, last_changed from states where entity_id = 'sensor.latest_trip' group by state

The idea for the future is:
  •     Have an automation that fires an event after a trip has completed.
    
  •     Collect the GPS information out of the database for the start and end time
    
  •     reverse lookup the address for start and end
    
  •     take the information and add a line in a google sheet
    

Are you running a sql database to your HA since you are using sql to pull the data?

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