Mercedes Me Binding

It’s time to share the Mercedes Me binding development. Got my EQA last week and got it running with Mercedes Benz integration. Based on this I started the development and it’s working since some days - time to check if it works out for you too.

Resources are available in the below repo.
Recommended read: readme for setting up bridge towards Mercedes Developer Project.

org.openhab.binding.mercedesme-3.4.0-SNAPSHOT.jar

org.openhab.binding.mercedesme-4.1.0-SNAPSHOT.jar

Feedback is highly appreciated!

6 Likes

It looks cool. I will try it out soon.

It is interesting that according to the readme you can monitor things like the doors, windows and light status. However I don’t see anything for monitoring status of tires, battery, coolant, washer fluid etc. Or am I missing something? Also I wonder if it can (and indeed should) monitor the vehicle alarm status, and the collision alarm (in case someone bumps the car in the parking lot).

Yes, please give it a try.

I owned an BMW before and much more data is provided. The 1st goal of this binding is to provide the official supported data from Mercedes.

I’m on the same page. Mercedes is providing much more data on their Mercedes Me App and I want these information too in openHAB - check control messages, tire pressure, max battery load, climatization, gps coordinates, service dates … But simply it isn’t accessible for now.

So let’s start with the official provided data and I’ll press Mercedes to provide more data for our purposes.

2 Likes

On the official supported data from Mercedes link that you provided, you had explicitly checked the ‘BYOCAR’ package. I am not sure what ‘BYOCAR’ is actually, but if you deselect it, the web page seems to imply that many if not most of the data that is available in Mercedes Me could also be available via the API.

image

BYOCAR is Build Your Own CAR and these APIs are free to access for everybody.

Select any other product and you’ll have and / or

  • sandbox version which provides only sample data
  • trial version with strictly limited calls
  • business version you’ve to pay for

See Traffic Sign Product with only Trial and Business version

I love to have these data but

  • sandbox data is useless for my specific vehicle
  • trial will simply stop after a certain amount of queries
  • business I don’t want to pay for data of my vehicle

We need to stress Mercedes–Benz /developers – The API platform by Mercedes-Benz in order to get more access to our own vehicles!

1 Like

HI, thank you for the nice binding

Is it possible to set it up using “files” instead of mainUI ?

Thanks Mads :slight_smile:

Sure - added full example section in readme

2 Likes

Fantastic :muscle::grin:

Do you know if it is a one time limit? Or (say) a maximum number of queries per day? If the latter, we could perhaps build in a mechanism in the binding to prevent exceeding the limit? (I don’t need to check my tires more than once per day…)

Hi @weymann

This is not obvious to me → Purpose URL: use link towards this binding description ←

What link, do i need to find further down in the readme ??

EDIT: is it this link → GitHub - weymann/OH3-MercedesMe-Drops: Development Drops of openHAB MercedesMe binding ← ??

Thanks Mads

Hi @weymann

Im trying to use the file based configuration.

I have made a new MercedesMe configuration for this binding, at first i tried to use the same on as i used with @spawny0815 solution.

But anyway i think its a problem with in Openhab, i get these errors.

2022-06-26 09:21:17.264 [INFO ] [g.mercedesme.internal.AccountHandler] - Config delivered ID 3xxxxxxxxxxxxxxxxxxxxxxxe, Secret exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxm, IP not set, Port 8090, scope offline_access mb:vehicle:mbdata:payasyoudrive mb:vehicle:mbdata:vehiclestatus mb:vehicle:mbdata:vehiclelock mb:vehicle:mbdata:fuelstatus mb:vehicle:mbdata:evstatus
2022-06-26 09:21:17.267 [INFO ] [g.mercedesme.internal.AccountHandler] - Config to edit Configuration[{key=fuelScope; type=Boolean; value=true}, {key=odoScope; type=Boolean; value=true}, {key=evScope; type=Boolean; value=true}, {key=clientId; type=String; value=3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxe}, {key=imageApiKey; type=String; value=exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc}, {key=callbackPort; type=BigDecimal; value=8090}, {key=lockScope; type=Boolean; value=true}, {key=callbackIp; type=String; value=192.168.0.101}, {key=clientSecret; type=String; value=exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxm}, {key=vehicleScope; type=Boolean; value=true}]
2022-06-26 09:21:17.285 [INFO ] [g.mercedesme.internal.AccountHandler] - Config not valid
2022-06-26 10:45:51.949 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:range#mileage REFRESH range#mileage
2022-06-26 10:45:51.981 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:range#range-electric REFRESH range#range-electric
2022-06-26 10:45:52.013 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:range#radius-electric REFRESH range#radius-electric
2022-06-26 10:45:52.044 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:range#soc REFRESH range#soc
2022-06-26 10:45:54.202 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:doors#driver-front REFRESH doors#driver-front
2022-06-26 10:45:54.234 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:doors#driver-rear REFRESH doors#driver-rear
2022-06-26 10:45:54.261 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:doors#passenger-front REFRESH doors#passenger-front
2022-06-26 10:45:54.270 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:doors#passenger-rear REFRESH doors#passenger-rear
2022-06-26 10:45:54.280 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:doors#deck-lid REFRESH doors#deck-lid
2022-06-26 10:45:54.289 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:doors#rooftop REFRESH doors#rooftop
2022-06-26 10:45:54.298 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:doors#sunroof REFRESH doors#sunroof
2022-06-26 10:45:54.307 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:lock#doors REFRESH lock#doors
2022-06-26 10:45:54.316 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:lock#deck-lid REFRESH lock#deck-lid
2022-06-26 10:45:54.325 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:lock#flap REFRESH lock#flap
2022-06-26 10:45:54.335 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:windows#driver-front REFRESH windows#driver-front
2022-06-26 10:45:54.344 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:windows#driver-rear REFRESH windows#driver-rear
2022-06-26 10:45:54.368 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:windows#passenger-front REFRESH windows#passenger-front
2022-06-26 10:45:54.404 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:windows#passenger-rear REFRESH windows#passenger-rear
2022-06-26 10:45:54.441 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:location#heading REFRESH location#heading
2022-06-26 10:45:54.477 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:image#image-data REFRESH image#image-data
2022-06-26 10:45:56.555 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:image#image-view REFRESH image#image-view
2022-06-26 10:45:56.566 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:image#clear-cache REFRESH image#clear-cache
2022-06-26 10:45:56.574 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:lights#interior-front REFRESH lights#interior-front
2022-06-26 10:45:56.583 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:lights#interior-rear REFRESH lights#interior-rear
2022-06-26 10:45:56.592 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:lights#reading-left REFRESH lights#reading-left
2022-06-26 10:45:56.601 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:lights#reading-right REFRESH lights#reading-right
2022-06-26 10:45:56.609 [INFO ] [g.mercedesme.internal.VehicleHandler] - Received mercedesme:hybrid:7000:A250e:lights#light-switch REFRESH lights#light-switch
2022-06-26 10:46:54.872 [WARN ] [g.mercedesme.internal.VehicleHandler] - Error getting data java.io.EOFException: HttpConnectionOverHTTP@bf2762::DecryptedEndPoint@38f90f{l=/192.168.0.101:49754,r=api.mercedes-benz.com/159.122.71.196:443,OPEN,fill=-,flush=-,to=1284717/0}

things:

Bridge mercedesme:account:7000   "MercedesMe" [ clientId="3xxxxxxxxxxxxxxxxxxxxxxxxxxxe", clientSecret="exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxm", imageApiKey="exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc", callbackIp="192.168.0.101", callbackPort=8090, odoScope=true, vehicleScope=true, lockScope=true, fuelScope=true, evScope=true] {
         Thing hybrid A250e           "Mercedes A250e"        [ vin="Wxxxxxxxxxxxxxxxxxxxx0", refreshInterval=5, background=false, night=false, cropped=false, roofOpen=false, format="webp"] 
}

EDIT: from the mainUI things, it seams that some of the configuration is running.

Configuration seen from mainUI

Thanks Mads

As far as I’ve observed it’s a one time limit as described. For images I called the API more than 5 times so I was able to get a full image set of my vehicle. But I needed to test the image caching and after a while I got 429 http responses.

Day change doesn’t reset the counter, regeneration of Image API key also doesn’t help.

Yes, I updated readme description to make it more clear

1 Like

Everything right on yor side. There’s a bug in my code when Bridge is initialized the first time. I fixed it already in the Marketplace version.

For you I think simply deactivate and activate your Account Bridge should do the trick. It’ll not go online but should forward you to the last setup step - the manual authorization

EDIT
One important note
If you share one Mercedes Developer project between the script solution by spawny0815 AND this binding only one will work! The token delivered will not be exchanged between these solutions.
Cleanest way is to create a new MB Developer project for this binding.

HI weymann

I did the disable / enable in mainUI, after this the callback thing was available :slight_smile:

Now everything worked as described in the readme, i cant test fully because the car is a the dealer for service, i guess when they start working on the car items will be updated :slight_smile:

Thanks Mads

1 Like

@weymann just to confirm that I got it working for my car :slight_smile:

However I do have a couple of feedbacks…

  1. I have a petrol engine car without pay as you go insurance. So during the thing creation, I manually de-selected the EV status, and pay as you go insurance status, in both the Mercedes project settings, and in the OH thing creation. However with those settings, the Authorization Workflow failed with an error that the selected functions did not match (even though they actually did match, albeit with fewer selected functions). I then re-selected the EV status, and pay as you go insurance status in both the project and the OH thing, and then the workflow succeeded. And finally after the workflow had succeed the OH binding itself ‘auto-magically’ disabled the EV status, and pay as you go insurance status; presumably because it had detected that those features don’t actually apply to my car.
  2. Minor point: there are two channels doors#deck-lid and lock#deck-lid; and when you use OH main UI to auto-create the respective Items, it shows a naming error because OH tries to create both Items with the same Item name. So perhaps you should use unique names if possible. (There may be other channels with the same issue…)
1 Like

Nice to hear it works!

There’s 100% no magic in this binding especially there’s no way to autodetect the Mercedes Developer project - otherwise I would implement this. But I know this is procedure is error prone and it’s worth to double check each step.

  • double check your configuration settings are saved
  • after this open the callback page in order the right scopes are set

In order to make it more transparent the callback page shows now the selected scopes too.

I see. The channel naming is ok but UI is creating Items from thing label and channel label. Both deck-lid channels had the same label and so you ran into this conflict. Solved now!

Hi @weymann

im getting this error every 20-30min

2022-06-28 00:23:53.552 [WARN ] [g.mercedesme.internal.VehicleHandler] - Error getting data java.io.EOFException: HttpConnectionOverHTTP@1799efb::DecryptedEndPoint@71ade4{l=/192.168.0.101:51094,r=api.mercedes-benz.com/159.122.71.196:443,OPEN,fill=-,flush=-,to=1284234/0}

Most items are working, i have been driving the car, open/close windows, mainlight swith etc. BUT

I don’t get any data in:
Odometer
Interior Front Light
Interior Rear Light
Main Light Switch

@weymann I am already finding some proposed corrections to your code. => May I suggest that you open your code as a DRAFT PR, so that I can give you feedback via the normal PR review process rather than in this thread?

EDIT: for example if one stops and restarts OH, then one must then disable and re-enable the MercMe account thing…

If you enable logging log:set DEBUG org.openhab.binding.mercedesme you’ll see the API responses directly. For lights I’ve nearly the same status, Main light was included before but data vanished after certain point of time, never got any feedback for interior lights.

For odometer I’m wondering a bit. Pls enable debug and check if some some Response 204 are occuring.