Mercedes Me Binding

Hi,

Partial success :slightly_smiling_face:

  1. Things are translated - this is OK
  2. Channales not translated

Thanks
Jirka

As said I’m still a bit confused regarding translations
@laursen In my last Pull Request for MyBMW binding you said translations are now handled via Crowdin. Shall the german translation file be removed from this binding?

No, the process is described here:

Please let me know if you still have specific doubts so I can try to clarify this description.

In short:

  • Default translations are provided with PR.
  • These are imported automatically into Crowdin.
  • Translations are then exported automatically from Crowdin into a PR.

Oh, you mean from this PR?

Ideally it should. It does not introduce risk of conflicts since the default translations doesn’t exist in Crowdin yet, but it does still short-circuit the proof-reading process and may require manual upload.

I got data once for a couple of days but know there is an issue with authentification:

2022-08-01 16:13:02.229 [ERROR] [oauth2client.internal.OAuthConnector] - grant type refresh_token to URL https://id.mercedes-benz.com/as/token.oauth2 failed with error code invalid_grant, description unknown, invalid, or expired refresh token
2022-08-01 16:13:02.229 [WARN ] [desme.internal.server.CallbackServer] - Error refreshing token null

Can anybody help me how to resolve this?

A token was available but unfortunately refreshing the token fails. Reason I cannot identify - just be aware that parallel access e.g. with the available scripting onto the same Mercedes Developer project will not work - they cannot share the token!

Resolve this issue with a new manual authorization run:

  • go to you your MercedesMe account bridge and copy the callbackUrl from Thing Properties - see readme
  • paste thes link into a new browser tab. Click on link Start Authorization. You should receive some feedback status ok

After this procedure bridge and vehicle shall run again.

Perform one additional check if the token is stored properly. Check in %USER_DATA%/jsondb if a mercedesme.json is present. At this location the token is stored

1 Like

Works out again. But have changed nothing now? Only confirmed up to the point where i received “status OK”.

A mercedesme.json has been stored. Thanks for your support. Will further observe this.

As said I cannot tell why the origin problem occurred. There’s no change in the binding itsself but of course after these steps are performed you received a new fresh token. You can see in the callbackUrl page scope offline_access is requested so in principle the authorization will never expire.

image

  • during runtime every refresh token call will renew the token plus the token is stored in /var/lib/openhab/jsondb/mercedesme.json
  • if you restart openHAB token is restored from mercedesme.json and it shall work fine
  • if you e.g. restore a openHAB backup from several days ago it might be possible the token is obsolete - manual request of new token is necessary

I know this isn’t convienent but currently I don’t have a better way of handling.

Hi @weymann

Question regarding update interval, i have refreshInterval=5 but it seems like its ignored ?

example from log:
12:11 next 12:33 = 22min
12:33 next 12:54 = 21min
15:54 next 13:15 = 21min
13:15 next 13:37 = 22min

Regards Mads

Just checked on my side: switched from 5 min to 1 min and back again and this worked fine for me.

I see in your screenshot the response from Mercedes API is printed as DEBUG log. This is an older version and in the meanwhile the binding has gone through the official openHAB review process with several findings fixed. The Pull Request is merged and the binding will be part in the next official OH release. If you want to see the API response messages you need to set loglevel TRACE.

Long story short:
Please remove jar file from addons folder, download again the jar from top post, it’s linked to latest version and check again with the newest version.

1 Like

Hi this morning i downloade the new version, stopped openhab, delete the old file, copy new file into folder, restarted openhab.

but is nearly still the same, now it tells me the theres no battery capacity given

I can see data regarding battery i changing

Info: im runing file based config

Regards Mads

Ok, I see.

No battery / fuel capacity isn’t a crucial problem and doesn’t harm the functionality. There are 2 newer config parameters which you can apply, see the actual readme


Based on soc and fuel level the binding is calculating how many kWh / liters

  • are still available
  • needs to be filled up for reaching 100%

These are also additional channels which are sadly not present after a simple reboot. This is a known problem and can only be solved via deleting and creating things again.
If you’ve textual configuration remove things file shortly and place it back again. Then the new channels shall appear and debug messages are gone!

Maybe this will solve also the 20 minutes updates which I cannot explain at the moment.

Hi, i have an issue with the electric range with my hybrid car. It seems that it somehow calculates the total range ( fuel plus electric ) when the item is updated.

2022-09-07 07:48:00.440 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 135 km to 0 km
2022-09-07 07:48:00.760 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 0 km to 135 km
2022-09-07 07:53:01.161 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 135 km to 0 km
2022-09-07 07:53:01.566 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 0 km to 135 km
2022-09-07 07:58:01.834 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 135 km to 0 km
2022-09-07 07:58:02.280 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 0 km to 135 km
2022-09-07 08:03:02.572 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 135 km to 0 km
2022-09-07 08:03:02.909 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 0 km to 135 km
2022-09-07 08:08:03.244 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 135 km to 0 km
2022-09-07 08:08:03.721 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 0 km to 135 km
2022-09-07 08:13:03.966 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 135 km to 0 km
2022-09-07 08:13:04.477 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 0 km to 135 km
2022-09-07 08:18:04.812 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 135 km to 0 km
2022-09-07 08:18:05.169 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 0 km to 135 km
2022-09-07 08:23:05.552 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 135 km to 0 km
2022-09-07 08:23:05.939 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GLC_Range_Electric' changed from 0 km to 135 km

mercedesme:hybrid:MercedesGLC:range#range-electric

Any thoughts on that one?
Thanks

This looks curious, I’ll check this issue

1 Like

For hybrid vehicle you’ll have

  • range-electric
  • range-fuel
  • range-hybrid → not given by Mercedes API - I sum them up inside the binding

What’s curious in the trace above is the flipping of range_electric during an update from orig value to 0 and then back again => this shall not happen. Also in my tests I cannot see this.

Please perform the following steps:

  • check on your side if you’ve the latest version installed. During development several changes were done. Link to actual jar is available on top post
  • Log into openHAB console and change debug level to TRACE: log:set TRACE org.openhab.binding.mercedesme
  • if problem still occurs send logs via private message or in this thread for further analysis

Thanks Bernd, I will have a look and let you know if the issue persists.

Unable to get it to work.
For some reason I get a very strange callback URL in openhab:

It is nevertheless configured as http://192.168.2.20:8090/mb-callback in the Mercedes API credentials and 192.168.2.20 is mentioned in my .things configuration (callbackIp)

Ahh sh*t, there’s a typo in the code which needs to be corrected.

Just to get it running:
change callbackIp to callbackIP in things config in order to check if it’s working.

1 Like

Yes, this resolved it. Thanks!

Hi Bernd, it seems the issue has been sorted with the latest version. Range electric value is showing correctly now. Thanks for your help.

1 Like