Mercedes Me Binding

@ulij
This looks like something is fundamentally wrong. Saw in previous posts you switched to openHAB Milestone 4.1, right?

I did this too and installed binding from Marketplace. Got the same errors!
Problem is within the Milestone version: Whyever Marketplace took the 3.4 bundle which simply doesn’t fit. Using Marketplace for 3.4 and 4.0 are working correct.

So if you’re running openHAB 4.1M1 you need to downlad the 4.1 smapshot bundle from Mercedes Me and drop it into addons folder

Thanks a lot!!!
Install the new binding and GPS work again !! :slight_smile:

1 Like

Tried that (and created fresh things) but I get the exception:

2023-09-27 14:03:13.518 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing ‘mercedesme:hybrid:mercedesme:XXXX’: ‘void org.openhab.core.library.types.DecimalType.(long)’
java.lang.NoSuchMethodError: ‘void org.openhab.core.library.types.DecimalType.(long)’
at org.openhab.binding.mercedesme.internal.handler.VehicleHandler.lambda$2(VehicleHandler.java:678) ~[?:?]
at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092) ~[?:?]
at org.openhab.binding.mercedesme.internal.handler.VehicleHandler.distributeContent(VehicleHandler.java:643) ~[?:?]
at org.openhab.binding.mercedesme.internal.handler.AccountHandler.registerVin(AccountHandler.java:249) ~[?:?]
at org.openhab.binding.mercedesme.internal.handler.VehicleHandler.initialize(VehicleHandler.java:151) ~[?:?]
at jdk.internal.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) ~[?:?]
at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

Update: I downloaded the org.openhab.binding.mercedesme-4.1.0-SNAPSHOT.jar following the link you provided but I have the impression that’s probably not the right version. At least I cannot find the bindingInfo tag in the proto_update JSON.
That would mean that I am probably on a pre-2.2-Alpha version.
Where can I find the latest version?
Next update: found it on github, copied it over (but quite sure it is the same I already had.
It looks like the bindingInfo is in the proto_update right after restarting but it disappears later.
Anyway, I don’t know what to try next.

@ulij
All the links to my binding in this forum are referring to the same github repo. There are no hidden version. You will not find anotherone!

The exception you post is too basic - it cannot be explained with the logic of the binding only with conflicting versions.
So I have it running on

  • OH3.4.5 Release Build - Marketplace working
  • OH4.0.3 Release Build - Marketplace working
  • OH 4.1.0M1 Milestone build - Marketplace not working - use addons folder

Which exact openHAB version do you run?

I am on Build #3629.
I was on snapshot and reverted to milestone.
Maybe that’s where it went wrong.
I’ll probably wait for the next milestone.

If you want to use openHAB for daily usage stay on stable versions like OH 4.0.3 where all features are working Snapshots are build daily and every new day there could be a surpise in it.

Nevertheless I switched to latest Snapshot #3647:

  • Doesn’t work with Marketplace - wrong binding installed - same exception as you posted!

  • uninstall Marketplace, drop binding into addons folder - works!

So let’s go into the machine room. Cleanup everything for mercedesme: Things, Bridges, Binding

  • UI
    • ensure everything is uninstalled from openHAB release & Marketplace
    • delete binding from addons folder
  • Your Server
    • check directory /var/lib/openhab/marketplace/bundles
    • any numbers in there? Check if one subdirs contains mercedesme binding and delete it
  • openHAB Console
    • on your server login to openHAB console with
      ssh openhab@localhost -p 8101
      Password: habopen
      type bundle:list -s |g rep merc
      Nothing shall be found! Otherwise tell me!
  • Perform a restart with systemctl restart openhab
    • Check again all steps above - no bundle in marketplace, bundle:list shows no MercedesMe binding

I’m pretty sure after this extensive cleanup the linked binding will work after dropping it into the addons folder.

1 Like

Thanks a lot!
Could not deinstall the marketplace binding via UI. Turned out to be a permission issue.
openhab-cli reset-ownership and then cleaning up again did the trick!
Will continue testing :slight_smile:

1 Like

I have installed the latest binding 2.3-alpha and found thi sin my logfiles

2023-10-01 10:52:59.210 [INFO ] [esme.internal.handler.VehicleHandler] - Received command class org.openhab.core.library.types.QuantityType 65 for mercedesme:hybrid:a0ec3af23a:A250e:range#soc
2023-10-01 10:54:59.452 [INFO ] [ding.mercedesme.internal.utils.Utils] - Cannot transform  / timestamp: 1696150396
int_value: 720
timestamp_in_ms: 1696150396000
display_value: "12:00"
clock_hour_unit: T24H
 Display Value 12:00 into Double
2023-10-01 10:54:59.468 [INFO ] [esme.internal.handler.VehicleHandler] - Received command class org.openhab.core.library.types.QuantityType 66 for mercedesme:hybrid:a0ec3af23a:A250e:range#soc

Is that intentional?
Otherwise the binding seems to deliver normal values.

Log message needs to be deleted.
Charging end time 12:00 cannot be transformed into DateTime but meanwhile I know the int_value is minutes after midnight.Prognosed end time of charging shall be shown correctly

Weird. I’m running OpenHAB 4.0.0 and tried to install from the community marketplace (I’m happy to muck about on the command line, but for my OpenHAB install I prefer not to) and it looks like it installed the 3.4 snapshot instead of the 4.0 one.

(running on macOS 10.13.6 with Amazon’s Correto 17 JVM)

Happened to me, too.
I had to do the following:

  • Reset the permissions with “openhab-cli reset-ownership” so the entire structure is owned by the openhab user
  • Remove all items and things
  • Remove old bindings (market-place or standard) via openhab console and from filesystem (follow post here : Mercedes Me Binding - #164 by weymann
  • stop openhab
  • tidy up with “openhab-cli clean-cache”
  • restart openhab or even better the entire server.
    That should get you sorted.

Ah, but I said:

running on macOS 10.13.6

This means no openhab-cli. I get to play with filesystem permissions all by myself.

Ok, it’s installed:

 28 │ Active │  80 │ 4.1.0.202309262106     │ org.openhab.binding.mercedesme

But when I go to the bridge item to do the auth process, I see “@text/mercedesme.account.status.authorization-needed” in the status bar.

Forging ahead…

  • I can see the callback URL under Thing Properties, although it’s [server-ip-address]:8090 rather than [server-name]:8090.
  • Manually opening that in a new window doesn’t work as it’s the address of the wrong interface (there are multiple interfaces on this machine).
  • Going to the right IP address gives me step one of the auth process and shortly after I have the email from Mercedes
  • entering the PIN on the “step two” page gives me a stack trace in the browser window:
HTTP ERROR 500 com.google.gson.JsonIOException: Failed making field 'java.time.Instant#seconds' accessible; either change its visibility or write a custom TypeAdapter for its declaring type
URI:	/mb-auth
STATUS:	500
MESSAGE:	com.google.gson.JsonIOException: Failed making field 'java.time.Instant#seconds' accessible; either change its visibility or write a custom TypeAdapter for its declaring type
SERVLET:	org.openhab.binding.mercedesme.internal.server.AuthServlet-2d94d1b5
CAUSED BY:	com.google.gson.JsonIOException: Failed making field 'java.time.Instant#seconds' accessible; either change its visibility or write a custom TypeAdapter for its declaring type
CAUSED BY:	java.lang.reflect.InaccessibleObjectException: Unable to make field private final long java.time.Instant.seconds accessible: module java.base does not "opens java.time" to unnamed module @35c5fce5
Caused by:

com.google.gson.JsonIOException: Failed making field 'java.time.Instant#seconds' accessible; either change its visibility or write a custom TypeAdapter for its declaring type
	at com.google.gson.internal.reflect.ReflectionHelper.makeAccessible(ReflectionHelper.java:23)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:203)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112)
	at com.google.gson.Gson.getAdapter(Gson.java:531)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:137)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:211)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112)
	at com.google.gson.Gson.getAdapter(Gson.java:531)
	at com.google.gson.Gson.fromJson(Gson.java:1057)
	at com.google.gson.Gson.fromJson(Gson.java:1016)
	at com.google.gson.Gson.fromJson(Gson.java:959)
	at com.google.gson.Gson.fromJson(Gson.java:927)
	at org.openhab.binding.mercedesme.internal.server.AuthService.saveTokenResponse(AuthService.java:227)
	at org.openhab.binding.mercedesme.internal.server.AuthService.requestToken(AuthService.java:156)
	at org.openhab.binding.mercedesme.internal.server.AuthServlet.doGet(AuthServlet.java:92)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:497)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:190)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final long java.time.Instant.seconds accessible: module java.base does not "opens java.time" to unnamed module @35c5fce5
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
	at com.google.gson.internal.reflect.ReflectionHelper.makeAccessible(ReflectionHelper.java:20)
	... 33 more

Versions, etc.:
OpenHAB 4.0.0 Release Version
macOS 10.13.6
Java:

openjdk 17.0.8 2023-07-18 LTS
OpenJDK Runtime Environment Corretto-17.0.8.7.1 (build 17.0.8+7-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.8.7.1 (build 17.0.8+7-LTS, mixed mode, sharing)

Here I can only guess but you may need to bind openhab to a specific IP address under network settings.
There you can set which address should be used and if openhab should listen on a single address or all.

I believe that you should be able to ssh into it.
Alternatively chown -R openhab.openhab in the installation folders should do the trick.
Just don’t do that on root level otherwise you will have to reinstall your machine :wink:

I appreciate the assistance but I’m ok on the CLI/operating system end of things, and it looks like the plugin is installed and at the correct version. The stack trace looks like a Java reflection issue so it’s possible that by running Java 17 I’m hitting something that was permitted in Java 11 or earlier.

Should not be an issue. I am running the add-on on 4.1-snapshot so I had to download the matching jar.
According to Bernd’s post Mercedes Me Binding - #162 by weymann market place should be fine for you. It definitely supports Java 17 as that is prerequisite for Openhab 4.

Translation issue - I need to fix this

Sure, autodetect IP address works for most users which are operating on a raspi. Overwriting IP address in config will come in next version ind advanced configuration settings

Saw this error also here. To be honest I don’t know why this isn’t working for you. But I think I can provide a fix.

I figured out the reflection error. Karaf on macOS generates an unusable openHAB-wrapper.conf[1], so I’ve been hand-editing mine to a working state over however many releases without really learning what the contents of the file do. Adding --add-opens=java.base/java.time=ALL-UNNAMED to set.JDK_JAVA_OPTIONS gives wrapper the required access to the java.time.Instant class. I’ve no idea if this should be required, but making this change and restarting OpenHAB to pick it up allowed me to complete the registration process.

[1] I can’t recall the exact problem other than that it was discussed at some point in the OpenHAB community and is apparently unfixable?

New problem! :slight_smile:

Added my BEV, set the Bridge to the active bridge, added the VIN, pressed Save, opened the BEV Thing, and:

Cannot invoke “String.startsWith(String)” because “pattern” is null

Stacktrace:

2023-10-17 22:02:36.473 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.mercedesme.internal.handler.VehicleHandler@6b6bcf19': Cannot invoke "String.startsWith(String)" because "pattern" is null
java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "pattern" is null
	at org.openhab.binding.mercedesme.internal.handler.VehicleHandler.updateChannel(VehicleHandler.java:937) ~[?:?]
	at org.openhab.binding.mercedesme.internal.handler.VehicleHandler.lambda$4(VehicleHandler.java:877) ~[?:?]
	at java.util.Map.forEach(Map.java:713) ~[?:?]
	at java.util.Collections$UnmodifiableMap.forEach(Collections.java:1553) ~[?:?]
	at org.openhab.binding.mercedesme.internal.handler.VehicleHandler.distributeContent(VehicleHandler.java:766) ~[?:?]
	at org.openhab.binding.mercedesme.internal.handler.AccountHandler.registerVin(AccountHandler.java:249) ~[?:?]
	at org.openhab.binding.mercedesme.internal.handler.VehicleHandler.initialize(VehicleHandler.java:151) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor37.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) ~[?:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

(this seems to happen when I save a change to the Thing, and is preceded by " [INFO ] [ercedesme.internal.utils.UOMObserver] - No mapping found for KM_PER_LITER" in at least two cases)