Mercedes Me Component

Using flows is a great start and this solution helped me to get some of the vehicle data into hass. However I’m strugging with some response problems of the Mercedes ME API. The flow is working as expected for a couple of hours but than I’m getting null values and a 204 status response from the API. Anyone experiencing the same issues?

Empty 204’s… I asked the dev-support about it a few weeks ago.

you get the HTTP 204 if you try to request data and the vehicle did not provide any new data or you are requesting data more than 12 hours after your last request.

What @riro said.

You have to deal with this situation in the flow, simply don’t publish a new value to MQTT in this case.

Hm… I understand but then it would be interesting why the vehicle stops providing any data at some point though the official app still get’s all vehicle status updates e.g. SoC as this is my relevant data point. I tweaked the refresh cycle from 5 min to 3 min and the got data flowing in without interruptions. But at some point during the night once again HTTP 204 and after that no updates even though I was driving the car so data must have been emitted. I’ll try to delete my current app inside the Mercedes ME portal and start from beginning.

To my understanding the reporting stops after a while when the value does not change, e.g. because the car is parked. For the SOC I can confirm the reporting resumes when the value changes. I believe the Mercedes me app behaves similarly and caches the data. The app even shows when the data was last updated.

No update could also mean the car is not online due to a bad network connection.

I am new here so I don’t have that much knowledge, but I am having trouble understanding the node-red flow. Whenever I add the client ID, it redirects me, and then Chrome gives me error ERR_CONNECTION_REFUSED.

Guys? https://developer.mercedes-benz.com/news/drive-your-dreams-home-mercedes-benz-mobile-sdk?csref=mc-soc_cn-PPSGC_GER_DEU_MBC_Multiple-Models_AWRN_MercedesMe_Mobile%20SDK%202020%20Social_2012_ci-141408_si-10461_pi-5200928_cri-50126

Hi Terp,

Thank you for this! This is fantastic. I couldn’t find a GitHub repo attached to it so I’ll ask my questions here:

  1. Is it possible to also add support for Pay As You Drive Insurance API? Adding an odometer with all the other data being collected adds another dimension to the data.
    • I did change the scope manually in the OAuth URL to include access to that API, but not seeing anything in the JSON file. All I see is “[]” for the whole page which indicates an empty JSON file on ym end.
  2. Where is the JSON file stored if I am not broadcasting messages via MQTT? Is there a limit to the collection?

Thanks for sharing your solution!

One question, this workaround allows us to get the location of the vehicle? Or only the lock status and fuel range?

Only the basic info, according to the devs, location has been removed due to privacy reasons. its also not possible to lock/unlock the car

Hi

You should be able to override the default scope by setting the env variable in docker: SCOPE=“mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:payasyoudrive”

and you can see the data in:

docker run -ti --rm -v mercedesme:/tmp --entrypoint cat terpz/mercedesme:latest /tmp/token

and

docker run -ti --rm -v mercedesme:/tmp --entrypoint cat terpz/mercedesme:latest /tmp/data

I also updated the image, so it should workaround the tokens expiring/deleted

Hi,

long time no message from my side. The delivery of my new car took some weeks longer.

I have created a prototype of a new integration. It’s an early version.

What should work:

  1. HACS integration via custom repo (https://github.com/ReneNulschDE/mbapi2020)
  2. Add the integration via the integration frontend
  3. Device Registry
  4. Some first sensors (including location and some other data that is not available in the official APIs)

Whats missing:
- A lot… most important - the websocket connection has no reconnect and need a HA restart. (Help needed in case you know more about AIOHTTP and Websockets

  • Adding more sensors
  • Adding configuration options (Exclude Cars, Rename Cars, Language)
  • Adding actions (Locks,Windows, Climate Control )
  • Change Devicetracker from old platform to new
  • … tons of other stuff

Please check the Repo for some more information.

Some pictures:
image

9 Likes

Just tested with my A200 Limousine in Belgium, works great.
Currently reporting 10 sensors

2 Likes

Same here in Spain! Works like a charm (on my B200)!! Thanks René for all your great work. I wish I could help out, but way to novice to even get close…

car

1 Like

Working great here - c350e in the UK. I’ve 11 sensors, but I notice that some of those have much more detail as attributes (e.g. liquid range, tyre pressure, etc), which is great!
I don’t get Position info - is that because I don’t subscribe to the relevant service on Mercedes Me?
I also don’t have Door status (open/closed/etc), which I do get using the MMe Dev API.

Thanks for the hard work - this will be really useful!

1 Like

Hi,

Thx. Yes, you need an active subscription for the location data. The door sensor is on the way into the repo :wink:

Sensors vs. attributes is a long discussion. I took the decision to add all the other relevant data as attributes to keep the frontend clean (yes, this was in times before Lovelace). You can create your sensors with a “template”-sensor with a reference to the attributes. This was discussed one or two years ago in this thread and you will find some examples.

But I’m open to make all the stuff available as sensors - just let me know… or make an PR

2 Likes

working very nicely again here in the Netherlands, A200. thanks again Rene!

1 Like

Great work, thanks for that nice integration… Works with our 2019 GLA W156…

1 Like

Hi @DerekO,

door options are available now as attributes of the Lock sensor.

image

1 Like