Page 3 of 8

Re: Mercedes Me (Connected Vehicle)

Posted: Thursday 13 May 2021 17:27
by kiddigital
Remember that the authorization code that you received (in the browser) is only valid for a short period of time (an hour if I remember correctly, have to look it up).

So you might have to get a new auth code and fill it in within Domoticz and try again. (Disable and enable hardware module again).

The way you describe things, it seems that you did the steps correctly.

You could try to start Domoticz with some debug flags (command line) to see if some more details are shown.
(Unfortunately I am not near a good working internet connection, so unable at the moment to look at things in detail).

Re: Mercedes Me (Connected Vehicle)

Posted: Monday 17 May 2021 9:54
by mbdeveloper
Hi JP, Hi Domoticz community,
prior to using the connected car products (BYOCAR) you need to enable your Mercedes me account accordingly. You need the product "Vehicle Setup" and within this product the "Remote Retrieval" service needs to be activated. And both the Mercedes me account (email) and the Mercedes-Benz /developers account must match 1:1.
I am not sure if this relates to this authorization issue. But I think it's worth to point this out.
Regards,
Olaf from Mercedes-Benz /developers

Re: Mercedes Me (Connected Vehicle)

Posted: Wednesday 19 May 2021 21:06
by honeywell
Dear,
Where exactly can I see I have the product 'Vehicle setup ' and where do I activate the 'Remote retrieval'?
Br,D

Re: Mercedes Me (Connected Vehicle)

Posted: Thursday 20 May 2021 7:52
by kiddigital
honeywell wrote: Wednesday 19 May 2021 21:06 Dear,
Where exactly can I see I have the product 'Vehicle setup ' and where do I activate the 'Remote retrieval'?
Br,D
You need to register yourself at the 'Mercedes Me' portal (which you probaly have done already) and make sure that your car is 'registered' to your account.

Within the 'car setting', there a (30+) services you can (de)activate and under the Comfort section their should be a service for 'remote vehicle data retrieval'. This one has to be active so data from the car can be retrieved at all.

The BYOCAR api's can than use this retrieved data as the input for the functionality of these API's.

Do you have the 'Mercedes Me' app (iOS, Android) installed on your phone/tablet? And does it show data?

As mentioned, you have to make sure that you use the same 'ID' (e-mailaddress + pass) to register as a Developer at mercedes, so the Developer functions (like BYOCAR) can be 'connected' to your Mercedes Me account and data.

Re: Mercedes Me (Connected Vehicle)

Posted: Friday 21 May 2021 11:13
by mbdeveloper
Dear All,
we have provided a Postman Collection for BYOCAR https://www.postman.com/mbdevelopers/wo ... umentation.
Feel free to use it. We think it might also help you in identifying potential issues in your local implementation.
Regards,
Olaf from Mercedes-Benz /developers

Re: Mercedes Me (Connected Vehicle)

Posted: Monday 31 May 2021 11:57
by kiddigital
JPY475 wrote: Thursday 13 May 2021 17:12 Hi,

I have installed the last version of Domoticz 2021.1 on a Raspberry PI and tried to have a connection with my Mercedes, following the explanation in this post.
...
Could you tell me what I did miss?
Thank you
Just wondering if you have been able to get everything working as it should? Let us know :)

Re: Mercedes Me (Connected Vehicle)

Posted: Monday 31 May 2021 11:58
by kiddigital
honeywell wrote: Wednesday 19 May 2021 21:06 Dear,
Where exactly can I see I have the product 'Vehicle setup ' and where do I activate the 'Remote retrieval'?
Br,D
And? Everything up and running now?

Re: Mercedes Me (Connected Vehicle)

Posted: Sunday 06 June 2021 9:14
by JPY475
Hi,

Thank you for your help

I prepared another Raspberry with the last image of OS and Domoticz.
I could get a connection with my car but I lost it after 1 day.
I will try further.

Maybe one question: How can I define my Home position?


Regards

Mercedes Me (Connected Vehicle)

Posted: Sunday 06 June 2021 9:23
by kiddigital
JPY475 wrote:Hi,

Thank you for your help

I prepared another Raspberry with the last image of OS and Domoticz.
I could get a connection with my car but I lost it after 1 day.
I will try further.

Maybe one question: How can I define my Home position?


Regards
Great to hear it works (partly).

When you keep it running, the authorization tokens get refreshed automatically.

But if it is not connected for a longer period (I think more that 24 hours), you probably have to generate a new access token (login in via the browser) and put that token into Domoticz.

Way easier to just keep it running Image

The Home position is the Home position of Domoticz (settings screen).

But at the moment, the BYOcar API’s do not provide any location information so nothing is done with it. The car will always be ‘at home’ even when it isn’t. The reason it is there is because for other cars like Tesla a location is available and the MercedesMe integration on Domoticz shares a lot of code/functionality with other Domoticz car modules.

Re: Mercedes Me (Connected Vehicle)

Posted: Monday 28 June 2021 16:28
by marcowork
dear team,

great initiative. I would like to add this to my domoticz environement however, I get this login error:

Code: Select all



2021-06-28 15:25:55.904 MercedesC220D: Attempting login (using provided Authorization code).
2021-06-28 15:25:56.162 Status: MercedesC220D: Received 400/401.. During authorisation proces. Aborting!
2021-06-28 15:25:56.162 Error: MercedesC220D: Failed to get token.
2021-06-28 15:25:56.162 Error: MercedesC220D: Login unsuccessful!
2021-06-28 15:25:56.162 Error: MercedesC220D: Aborting due to too many failed authentication attempts (and prevent getting blocked)!

I tested my username and password on the mercedes me site and they work. So I do not understand why I cannot login with the same credentials

I also checked the Vehicle setup: All service are enabled and valid to somewhere in 2022 or indefinite. So why doesn't it work.
I only have an mercedes me account and no developer account. Can this be it?

Mercedes Me (Connected Vehicle)

Posted: Monday 28 June 2021 20:30
by kiddigital
marcowork wrote:dear team,

great initiative. I would like to add this to my domoticz environement however, I get this login error:

Code: Select all



2021-06-28 15:25:55.904 MercedesC220D: Attempting login (using provided Authorization code).
2021-06-28 15:25:56.162 Status: MercedesC220D: Received 400/401.. During authorisation proces. Aborting!
2021-06-28 15:25:56.162 Error: MercedesC220D: Failed to get token.
2021-06-28 15:25:56.162 Error: MercedesC220D: Login unsuccessful!
2021-06-28 15:25:56.162 Error: MercedesC220D: Aborting due to too many failed authentication attempts (and prevent getting blocked)!

I tested my username and password on the mercedes me site and they work. So I do not understand why I cannot login with the same credentials

I also checked the Vehicle setup: All service are enabled and valid to somewhere in 2022 or indefinite. So why doesn't it work.
I only have an mercedes me account and no developer account. Can this be it?
Hi @marcowork,

Where you able to follow the steps as described in the first posts of this topic?

Make sure you have all API’s activated.

Then use the login url (see start posts) to get your access code that should be entered within Domoticz.

And make sure that ‘enable new hardware’ is on for at least 2 hours as it takes a while before all available data is put into custom sensors (when enabled).

Let us know if you get it running…

Re: Mercedes Me (Connected Vehicle)

Posted: Monday 12 July 2021 21:02
by kiddigital
@marcowork,

Did you get it running :) ?

Re: Mercedes Me (Connected Vehicle)

Posted: Tuesday 27 July 2021 13:30
by rolandbreedveld
created my mercedes develop account, with multiple projects,
when using tis url with my ID :
https://id.mercedes-benz.com/as/authori ... state=test
I get:
Error
Oops
Looks like something is not right. Please contact your administrator.
400 - Invalid redirect_uri
looks like it's not working , or did I miss something

In Domoticz I get a login failure

Re: Mercedes Me (Connected Vehicle)

Posted: Tuesday 27 July 2021 14:33
by kiddigital
@rolandbreedveld

Did you configure the redirect_uri (https://localhost) also in your Project (see Project Credentials) within the Mercedes Developers Console?

The redirect_uri needs to be known, otherwise the redirect will not happen.

Re: Mercedes Me (Connected Vehicle)

Posted: Tuesday 27 July 2021 15:34
by rolandbreedveld
kiddigital wrote: Tuesday 27 July 2021 14:33 @rolandbreedveld

Did you configure the redirect_uri (https://localhost) also in your Project (see Project Credentials) within the Mercedes Developers Console?

The redirect_uri needs to be known, otherwise the redirect will not happen.
The rederect URL is :
https://localhost

In Domiticz:
2021-07-27 15:35:16.147 EQA250: Attempting login (using provided Authorization code).
2021-07-27 15:35:16.669 Status: EQA250: Received 400/401.. During authorisation proces. Aborting!
2021-07-27 15:35:16.669 Error: EQA250: Failed to get token.

Re: Mercedes Me (Connected Vehicle)

Posted: Tuesday 27 July 2021 16:16
by kiddigital
rolandbreedveld wrote: Tuesday 27 July 2021 15:34 ...
In Domiticz:
2021-07-27 15:35:16.147 EQA250: Attempting login (using provided Authorization code).
2021-07-27 15:35:16.669 Status: EQA250: Received 400/401.. During authorisation proces. Aborting!
2021-07-27 15:35:16.669 Error: EQA250: Failed to get token.
So you were able to get an authorization_token in the URL after logging in on the MercedesMe portal?
Just checking.. your account for MercedesME is the same as on the Dev Portal?
Once you get an authorization_token, this code is only valid for a short time (I thought 60 minutes). Try to get a new authorization_token and try again.
If the authorization_token contains a '+' or '/' character, apply for a new one as I think there might be an encoding issue with these characters.

Re: Mercedes Me (Connected Vehicle)

Posted: Wednesday 28 July 2021 17:17
by rolandbreedveld
@kiddigital
it finaly works,
The URL is changed, with the current one You'll get no login screen but a: "The requested scope is invalid"

you have to add "&prompt=login consent" to the URL, the correct URL will be:

Code: Select all

https://id.mercedes-benz.com/as/authorization.oauth2?response_type=code&client_id=<CLIENT-ID>&redirect_uri=https://localhost&scope=mb:vehicle:mbdata:vehiclestatus%20mb:vehicle:mbdata:fuelstatus%20mb:vehicle:mbdata:payasyoudrive%20mb:vehicle:mbdata:vehiclelock%20mb:vehicle:mbdata:evstatus%20offline_access&state=test&prompt=login%20consent
Had to do it twice, it's important that the car is "alive", first time I get "waking up the car", after a while the authentication was timed out.

regards Roland

Re: Mercedes Me (Connected Vehicle)

Posted: Wednesday 28 July 2021 18:36
by kiddigital
rolandbreedveld wrote: Wednesday 28 July 2021 17:17 @kiddigital
it finaly works,
Great :D
rolandbreedveld wrote: Wednesday 28 July 2021 17:17 The URL is changed, with the current one You'll get no login screen but a: "The requested scope is invalid"

you have to add "&prompt=login consent" to the URL, the correct URL will be:

Code: Select all

https://id.mercedes-benz.com/as/authorization.oauth2?response_type=code&client_id=<CLIENT-ID>&redirect_uri=https://localhost&scope=mb:vehicle:mbdata:vehiclestatus%20mb:vehicle:mbdata:fuelstatus%20mb:vehicle:mbdata:payasyoudrive%20mb:vehicle:mbdata:vehiclelock%20mb:vehicle:mbdata:evstatus%20offline_access&state=test&prompt=login%20consent
Had to do it twice, it's important that the car is "alive", first time I get "waking up the car", after a while the authentication was timed out.

regards Roland
Thx for reporting, new to me :) But that's the benefit of the refresh_token usage, once it is running and keeps running, no need to re-authenticate :)

Re: Mercedes Me (Connected Vehicle)

Posted: Wednesday 28 July 2021 19:53
by rolandbreedveld
Thx for reporting, new to me :) But that's the benefit of the refresh_token usage, once it is running and keeps running, no need to re-authenticate :)
That's right, it's only for the first time.
Found it on https://developer.mercedes-benz.com/con ... umentation right column.

Re: Mercedes Me (Connected Vehicle)

Posted: Tuesday 10 August 2021 17:27
by rolandbreedveld
@kiddigital
Is there a way to send commands to the car?
I'm looking for a way to stop/start charging, when my solar panels are producing energy.