Mercedes Me

I got the following error when the account thing start:
COMMUNICATION_ERROR
Websocket Exception: Reason: 401 Unauthorized

My config and generate token procedure as follow:

  1. Openhab installed in rPi 4
  2. I downloaded and installed the token generator app in my iMac
  3. Open the app in iMac, an new windows opened. up and ask me sign in
  4. After sign it I got a Access token and Refresh token’
  5. Copied the refresh token into the account thing setting “refresh token” field
  6. Above communication error appear after save

Any idea what’s the problem or mistake I made?
Thanks.

Ok,we’re one step further to identify the problem. Binding start fails and this explains the missing handler factory. Now we have to see why, maybe some incompatibility with OH4.1.

Please perform the following sequence and send me the logs directly to me as personal message - Ithey will be too long for a forum post.

bundle:stop 353
log:set TRACE org.openhab.binding.mercedesme
bundle:start 353

Hello everyone!
Now I have also set about importing the new jar. Now I’m trying to create the token. Problem: I only have an imac with 12.7.6 and not one with 13.5. I can’t get a new version on my imac either. I also don’t have a Windows 10 computer. How do I get a token in this case? Do I have to buy a new Imac for 2000 euros so that I can create a token or is there another way?
I would be happy about any help.
Best regards

Flow looks good and is exactly as described. Is this your first time setup or did you run the binding also before?

I have to admit that first version contains a bug regarding check of token validity. The check for expiration says “not expired” but in fact token is expired. This matches to error code 401.

Uploaded a fix right now so please uninstall and then reinstall marketplace binding. Either it heals automatically after exchange or another refreshToken generation is necessary.

Thanks a lot.
It works after uninstall and install the binding, then generate a new token.

I did the whole thing on a friend’s Win10 computer. I have the refresh code. It also works currently.
I hope I don’t need a new code every week… I can’t drink that much beer with my friend for his help. :slight_smile:
Thanks for the update. Good job.

Hi Bernd, thanks for the feedback and help, the result of the shared sequence is that the binding works and Mercedes Me is on line again. In the log a lot of errors en debugs resulting in the on line status. Are you still interested in the logs? If so I will send them to you as a personal message

Very good, nice to hear it’s working!

Don’t need logs if binding is running. Wanted toi check if there’s a potential incompatibility with OH4.1 but now it shows there’s no issue. Pretty sure this binding version fits to all OH 4.x versions.

This sounds great, but I would need some help.
If I’m setting up the mercedesMe Bridge, it get immediately ONLINE, even with the wrong refresh token.
If I setup the dedicated var via VIN with this bridge the Things stays in UNKNOWN.

The refresh token is generated on a MAC, the openHAB installation is running on a RPI4.
Is it a problem, if the token generation is taken place on a different machine ?
In the openhab.log I find the following line
2025-02-09 18:08:15.341 [WARN ] [openhab.core.io.rest.auth.AuthFilter] - Unauthorized API request from x.x.x.x: Error while processing JWT token
x.x.x.x. is the machine where the token is generated.
What is my error ? Thanks for any help.

In the openHAB console I see:
image

runtimeInfo:
version: 4.3.2
buildString: Release Build
locale: de-DE
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 17.0.13
javaVendor: Raspbian
osName: Linux
osVersion: 6.1.21-v8+
osArchitecture: arm
availableProcessors: 4
freeMemory: 6362768
totalMemory: 259522560
uptime: 157941
startLevel: 100

This is true if you’ve a previous installation. As said in my post before if a stored token is available there’s no need to generate a new one:

Is this a new setup? Isn’t the car reported in discovery?

All fine - token doesn’t depend on any OS.

Total different story. Somewhere you’ve a browser tab open with openHAB API Explorer and the JWT token expired - nothing to do with this binding.

Ok, too many details till now.
Version from Screenshot is fine, bundle started - so Installation looks good.
For analysis please help me with the following steps:

  • disable created car
  • disable bridge
  • set loglevel of mercedesme binding to TRACE
  • enable bridge - what are the logs showing?
  • enable car - also her: what are the logs showing?

Dear Bernd, thank you very much for the fast feedback. As I have for “add-on settings” only an emty page, I can’t change to TRACE settings. Before the installation of the binding from yesterday I had as well installed other version’s of the binding. From marketplace and as well *.jar files. Uli

Right, that’s curious. I double checked all my installed Marketplace Bindings and none of them have the option to change log level. If I drop them into addons folder I can change it! Seems I need to file an issue!

But you can also change it via UI in the API Explorer in logging section. See attached picture and request boday below

{
  "loggerName": "org.openhab.binding.mercedesme",
  "level": "TRACE"
}

This is already known, no need to file an issue.
Marketplace Bindings have a different listing after installation, thats why the loglevel cannot be set through UI.

Dear Bernd, I have done so. Find attached the log file.

Thx for logs, much clearer now.

Technically it’s not a problem related to the new Auth method. Account / Bridge is ONLINE so this is working.

Vehilce stays UNKNOW because no data is received. This problem is reported 2 times e.g. from @OpenMarcus here. Sadly his vehicle causing this problem was taken offline by Mercedes so I wasn’t able to follow up this error.

I have not seen any updates of my data for a couple of days. I reinstalled the binding and restarted openhab but still no connection with the car data. What can I do?

First some more information is needed.

  • enable trace level for binding
  • to enforce an update: shortly disableMercedesMe Account and start it again
  • after that we can check the traces together

Hi, how do I ”disable” the account?

Pause button on the top right

Ok, the log is full of messages reporting websocket related problems. I run openhab in a docker container, could that be problem (combination websocket+docker) ?