Mercedes Connected Car API

I’m glad to read that Olaf.
I have chosen the topic as a Python learning project. I now have an automated login procedure and can access data from my vehicle.
The API access to the different endpoints is currently still hard coded. I would like to get the token refresh done first.

As soon as I am further along, I could imagine publishing the whole thing here. Maybe it helps someone to build the whole thing as an openhab binding.

Cheers Chris

1 Like

I now have a running python environment.
From this I would like to build a multiplatform app (for learning purposes).

However, I looked at how to get the whole thing into OH as quickly as possible before I start with the app.
When asking how to capture the Auth_Code I remembered the way the spotify integration worked in the beginning.
(GitHub - pmpkk/openhab_spotify-webconnect-api: A simple Python script to integrate Spotify's Web Connect API (https://developer.spotify.com/web-api/web-api-connect-endpoint-reference/) to OpenHab (openhab.org))
When I looked at this my eye twitched nervously. pmpkk has already built almost everything for the MB Oauth process.

I should have remembered this earlier :slight_smile: Would have saved me work.

The good thing is that I have already started to rebuild the whole thing based on pmpkk for the Mercedes-Benz API integration in openhab.

the next step will be to read all the API endpoints cleanly.

My attempt to retrieve all the data I have unlocked in the Mercedes-Benz console, unfortunately failed. (although my vehicle is listed for it)
I’m not sure yet what the reason is, but it can’t be too much more. Some data like rangeliquid, doorlockstatusvehicle, positionHeading work great.

As soon as the work is finished it would be nice if a tester could be found.

Cheers Chris

1 Like

Hi spawny0815, im ready if you need testing, i have A250e hybrid 2020 model.

Regards Mads

Hi,
just wanted to give you a little status update.

the openHAB integration is already quite far.

Currently I am still working on the individual parameters that are passed for each api. This is just a lot of copy&paste for now.

I have also started to write the vehicle images function. I think the whole thing is really nicely done by Mercedes-Benz. However, it is questionable how useful the whole thing is in relation to smarthome. Maybe I limit it in the standard to a single image which can then be used for the UI.

Attached is a small preview:




Cheers Chris

3 Likes

That’s pretty cool what you achieved here.
Regarding how useful it is: Triggering the pre-heating depending on the temperature and your daily working hours plus detecting when e.g.you actually started your morning shower might be really nice.
Checking the fuel level in combination with the gas prices and the distance to the cheapest gas station might be something else.

Besides that I goes many here did some things with openHab just because it can be done…

Hey Thomas,
thanks for the answer.

By “useful” I meant all the many different images. I think it’s useless that I download all images (in all variations) in standard mode. So I’m thinking about downloading only one image in standard.

The rest of the data I find of course very useful!

Cheers Chris

Agreed, a single small image is enough.
Guess we know how our cars look like :slight_smile:

Hey,
small status update.
I have made good progress so far.

The auth process looks very stable.
I am also successfully calling the following endpoints:
“Fuel Status API”
“Electric Vehicle Status API” * implemented but not tested
"Vehicle Lock Status API
"Vehicle Status API
“Pay As You Drive Insurance API”

I have already implemented and tested some error queries and working on stability.

Some parameters like “roof open” and “hv battery capacity” I can’t test because my vehicle doesn’t provide these parameters, however they are implemented.
Would be nice if this would still find tester.

I have already discovered a few strange things in the mercedes api.
I have already reported a bug, the developers are now working on it.

Unfortunately, I can no longer get on with the images API. Again, I suspect a bug in the API. I will test this further and report it if necessary.
So long I can only do dry runs.

I am not sure if I should publish the whole thing here before the mercedes developers have corrected the bugs.

2 Likes

I could help testing the roof status. Auxiliar heating would be possible too.
Regards
Thomas

Hey,
weekly status update :slight_smile:

through some tests and the help of @Mads_Bloch i could fix some bugs through different environments.

i have also improved the auth website, increased the security of the auth process and eliminated errors that can happen in some situations

my python script is running stable in the background for a while now.
i think it is stable enough for a release.

i’m just waiting for two more answers from the mercedes dev team and under that i’m preparing some things for the release.

The first release will have to do without the vehicle images. I have now run into my free limit. each additional attempt now costs about 25€.
So i will try to prepare the process as good as possible with the trial API.
In addition, I am not sure how I should regulate the images. Each user has only 5 free calls. I don’t want to just make a call using my script. Anybody have a good idea?
@OlafStelter Would be nice if there was a standard image which has no call limit.

Furthermore i have seen that with oh3 it is possible to set an authentication on the REST API. Since I am basically a fan of such procedures, I would like to use this also in this script.
However, I am still on oh2. Still I shy away from the update because I have quite a large setup to move. But as soon as I am moved I will do it.

Chris

3 Likes

Hey Chris,

why not simply remove the image from the script? It is not of very much importance and anybody using it will have the car available and can take a shot himself or use a screenshot from his installation of the mercedes me app. Displaying this image in OH should be no problem at all.
In my opinion it is not worth investing here.

Regards
Thomas

Hy Chris,
the images are free in the trial mode only (<= 5 calls). Images will not change when using the car. Thus, please call images just one time and cache the images. They can be used at the vizualisation layer. Even though, you all know how your car looks like :wink: You are free to take just one image - no need to download all available ones.
Regards,
Olaf from Mercedes-Benz /developers

Hey,

I understand your opinions about the pictures. And yes I definitely don’t want to see this as a blocker.
However, I think it’s nice if there is already the possibility to directly provide a matching vehicle image in a modern visualization.

Currently I have implemented the image function as a separate script call. I will keep it that way. And let the user decide whether he does this or not.
At the moment I leave this out for reasons already described.

But enough written, I have to use the time to get everything ready :wink:

1 Like

First release:

5 Likes

Congrats on what you achieved with the Mercedes-Benz integration.
We really appreciate your engagement.
We would like to promote you solution on our developer portal inspire section.
Are you interested?
If yes, please send us a short notice (developer@mercedes-benz.com). I will contact you to further discuss the what, how and when.
Cheers,
Olaf from Mercedes-Benz /developers

5 Likes