Mercedes Benz integration

Hey @alexander_romanov_pv ,

under the products you can look up for which markets the whole is valid.

Australia is unfortunately not listed here.

Chris

Maybe you would receive the vehicle images upside down… this could cause compatibility issues :wink: :upside_down_face:

1 Like

Nice one Thomas! :rofl:

1 Like

fyi: I started to integrate MercedesMe into the CarNet binding. So far I implemented a different login approach using a login code. The big advantage is that the initial setup is way easier. I already saw the access_token. Next is getting vehicle list and adapt the different API calls (status & control).

The final channel layout will be different to this integration, because I’ll unify with existing
implementation.

Let me know if someone wants to help on initial tests and testing. Updates will be posted to ConnectedCar thread

5 Likes

ok, let’s start testing :slight_smile:

@Oggerschummer @Kennet @spawny0815 @mst87 @tkropf @nils.schnabel @igi @hmerk
find infos here: ConnectedCar Binding myAudi, Volkswagen, VW ID, Mercedes, Skoda, Enyaq, Seat, Ford, WeCharge - #585 by markus7017

3 Likes

Very nice explanation of how to install the application! I managed to go through it completely. Unfortunately, I keep getting an error when running the script. Any idea what I am doing wrong?


[20:53:03] pi@openhabpi:/etc/openhab2/scripts/mb-connect$ python3 /etc/openhab2/scripts/mb-connect/mb-connect.py --data
  File "/etc/openhab2/scripts/mb-connect/mb-connect.py", line 332
    reply = input(f"{question} (y/n): ").lower()
                                      ^
SyntaxError: invalid syntax

You have to delete the “f” from → input(f"…

…but then there are even more errors.

The multi-line comment symbols are also a problem as well as .isoformat argument “timespec” for the milliseconds

Hey @DaveVdB @Mathias_Guderjahn ,

have you checked the requirements? python version?
I really don’t have much time at the moment. If you can help me and describe your setup in more detail, I can help you with it easier and faster.

Chris

Hello, just tried to install the integration but fail to get the authentication Code.

After configuring the products with MB and then in the redirectURL (all ticks are green) I get an error after clicking ‘Authenticate’ saying ‘400 - Invalid redirect_uri’ while expecting to be forwarded to the MB-Connect site for login.

Any idea what I did wrong?

Christian

Great project & documentation :+1:

But first of all: Is it still “online”, i.e. functional? If so, unfortunately not for me.

Hence my questions…

Mercedes server-side setup

  • Special AppName required?
  • Where can I find the “API key”?
  • Is there a data access/error history?

openHAB server side

So forbidden access to the ./resources folder.
Of course, nothing is fetched from MB server :frowning:
What causes the access ban?
Still missing any rights on MB side?

Is my MB Project ID needed anywhere?

Any tip welcome.

I’ve come to believe that the MB Server project name must contain the openhab keyword. Will try that soon.

With the openhab keyword in the project name, I have now received the API key for the image download. So: The –get_images download works now. But with the –data query of the individual statuses, the answer is always “Access forbidden”.

Any idea?

Hi all,

thanks for your support here. :wink:

Any chance to see a Binding for that, sooner or later?

thanks again
Andrea

For those having troubles to execute the python script through the rules, here is what I did:
Changed the rules file as following:

var content = executeCommandLine(Duration.ofSeconds(45), "/usr/bin/python3", "/etc/openhab/scripts/mb-connect/mb-connect.py", "--data")
console.log("Log: ",content);

This way, I could see the output of the script running in Frontail.
I could then see that the script gave an error: "“No module named ‘openhab’”
Strangely enough, executing this script from the raspberry pi terminal through SSH worked fine, but executing it through the openhab rule gave this error.

I was not able to resolve the error itself (maybe someone else has an idea?), but I found a workaround, by executing the script through crontab.

From the terminal:

sudo crontab -u openhabian -e

and then add at the bottom

*/10 * * * * python3 /etc/openhab/scripts/mb-connect/mb-connect.py --data

It’s important not to use “sudo crontab -e” but to use “sudo crontab -u openhabian -e”. The former uses the crontab of the root user, but the script needs to be executed by the user “openhabian”, or it will not pump the data to openhab.

This way, the script executes every 10 minutes through the openhabian user, and the data is pumped into openhab

I can help on initial tests and testing. Please let me know how :slight_smile:

How fast can the data be polled by OpenHAB? An idea would be that if the car is near the garage and a light switch (or any other switch) is toggled that the garage door opens. But I guess the delay might be too large?

I just set this up today; kudos to @spawny0815 for putting it together. I do have a question, though: this defines a bunch of Items, but there isn’t a corresponding Thing (as far as I can tell) to allow me to incorporate the Items into e.g. the Model. Am I missing something here - is this intended to be used with a pre-existing Thing, or is the Item-without-Thing approach working as designed?

You can add the items, just set the checkbox to show non-semantic items.

1 Like

Thanks, that allows me some control, but the items are largely read-only so I can’t e.g. rename them (without changing the feeder script). I guess I can use it as-is for now.

Got things running with this setup with my new EQA. Based on this I implemented the Mercedes Me binding. I need your expertise now!