Homey Community Forum

Mercedes Me App (Release 0.1.2 and Test 0.1.2)

I have made a new Mercedes Me app that works with Mercedes current API. The app is in the HCS Homey Community Store and is now live in the Atom store Mercedes Me App for Homey | Homey

Unfortunately it takes a bit of work to setup as Mercedes have locked down the API very tightly.
You will need to create an application in https://developer.mercedes-benz.com/
The following steps should get you started:

  1. Login using your Mercedes Me account details
  2. Click on “CONSOLE.”
  3. Click on “Add Project”
  4. Enter a Project Name such as “Homey{yourname}” where {yourname} is your name. Every project name has to be globally unique so you might need to change it if it is already taken
  5. Fill in the Business purpose box with something like “Adding my Mercedes to my home automation system”
  6. Click on “CREATE”.
  7. Click on “APIs”
  8. Scroll down until you see “Electric Vehicle Status” and click on the image.
  9. Click on “GET ACCESS”.
  10. Click on “GET FOR FREE”.
  11. Click on “BYOCAR”.
  12. Make sure your project name is shown
  13. Click on “SUBSCRIBE”.
  14. Click on “BACK TO PRODUCT OVERVIEW”
  15. Repeat steps 8 to 14 for the following APIs: Fuel Status, Pay As You Drive Insurance, Vehicle Lock Status, Vehicle Status and Connected Vehicle (from experimental).
  16. Once you have add all the APIs, click on “CONSOLE” again
  17. Click on “Project details”. You should now see your Client ID and Client Secret that will be required by the Homey app.
  18. Click on the plus box to the right of the Redirect URLs and add https://callback.athom.com/oauth2/callback
  19. Delete the original local URL.

That should have completed the Mercedes App setup part.

Note: One user has reported they had to also add the Connected Vehicle API from the Experimental products section. Without that API he was getting an error message when adding the car to Homey.

When you have installed the app you will need to open the “Configure App” page in the App settings.
In the Settings tab, enter your Client ID and Client Secret that was shown in the Mercedes Me app setup.
You will also need to enter your vehicles VIN number. You can find this in the Mercedes Me phone app by taping on the menu button, tap on the image of your car, select Vehicle information and the number is displayed just above your registration plate number.

Finally you can add a new device in Homey and select the car. If the app has not already been authorised, you will see a page from Mercedes asking you to grant access permissions. Make sure all the options are turned on and then accept.
Next, one device should be present for you to select and add.

The status values will only update once they are available from Mercedes. You might need to unlock and lock the car and put windows up and down, etc to make the car send the status updates to the server so they are given to the Homey app.

Version Log

0.1.1

  • Added trigger flow cards for vehicle locked / unlocked and condition card for vehicle is / is not locked

0.1.2

  • Added condition card for any window or sunroof open.
7 Likes

Thanks so much Adrian, this looks promising!

At the final step of adding the car as device in the Homey app I get an error (from Homey) stating “Authorization code is malformed.” What am I doing wrong?

BR.

Could you try adding the Connected Vehicle API from the Experimental products section. It seems that solved the problem for another user with the same error message.

1 Like

Amazing, that did the trick indeed! Will start experimenting with this (not all values visible yet), thanks again!

That’s good.

The values only appear once the car sends them to the server so you might have to open/close doors and windows etc to force an update.

1 Like

Thank you for the kind donation, its much appreciated.

1 Like

Hi Adrian,

Implemented using the test version of the app:
- send a notification when the car has been unlocked and it is at home/within geofence and nobody is at home/all are asleep

(for now to be solved with boolean)

Looking at the available values I am pretty sure not all will be possible and of course some parts of these flows/user-stories will come from other apps. There may also be a big difference in a query for information and sending commands… Anyway, here are a few ideas for filling the backlog :wink:

I would love to:
- get a notification when the car has been locked but not all windows/sunroof are closed
- have all windows/sunroof closed when rain is expected for my location
- get a notification if the planned route that was sent to the car exceeds the fuel range
- have the sunroof open itself when a planned route is sent to the car and the (outside) temperature is above x degrees

By no means I am trying to create assignments, but this is on my mind when it comes to using the car info for automation. Happy to buy you more beers when things evolve :wink:

-Bas

So the test version has the when card for the car has been locked and the window states are available using logic cards with the tags. But i will add a condition card for “A window or sunroof is open” as I can see that will reduce thenumbe rof conditions to check for.

The API doesn’t currently allow any commands to be sent but if Mercedes add that feature I will jump on it.

The fuel range is available via a tag but the API has no way to get the planned route information. I will keep checking in on the API changes to see what features they add and implement them when possible.

Again no way to get the route or send commands.

Thank you for the suggestions though. The only way I will know what users want is if they ask so all feedback is good. However, as in this case some of the features are not possible due to the restrictions in the API.

Ah I didn’t realize, that’s great! This opens up possibilities already! Thanks for the swift reply, adding the “aggregated condition” and keeping an eye on the API capabilities!

The Experimental Connectec Vehicle API was indeed necessary.

I will add it to the standard instructions.

Added the connected vehicle api, but still i get error “auth code is malformed”

Could you enable the diagnostic log, try adding the car and then send the log.
Also I would recommend copy and paste to enter the Client Id, Client Secret and VIN no details as they are very long and easy to make a mistake.

Sent diagnostics

I have received the log but it is empty. Was there something in the list below the buttons when you sent it?
Was the tick a blue colour?
Homey style for checkboxes uses a grey tick for disabled and a blue tick for enabled which has caught out a lot of users.

I forgot to add the insurance api. After i added that api, i got to a screen asking for permission to access. I accepted and got an generic error. Logging is enabled(blue tick) but the box is still empty. Will logging info appear there?

Success! Car added, but only 1 box have any info. But wife is out driving the car now, will investigatw further when the car is parked. Thany you for your swift response!

Excellent. The app is still new so I am learning how thing can fail as well :wink:

The API only sends changes when they occur. So to get things to populate you might need to use them. E.g. lock / unlock the car so the new status is sent to the server and then it should filter through to the app.

The car is an B250e, was interested in getting the battery status, but it is still blank. Unlock status have updated itself. I see great potential in automating the charge to just finish before i leave in the morning.

With the log enabled do you see a section with any of the charge status information?
I have just spotted an error in my logging so it will show two sections for “VS:[” instead of one for “EV:”, copy and paste error :frowning:
As I don’t have an EV I haven’t been able to test that section, so it could be the names of various things don’t match.

Again, could you keep the logging enabled for a while and then send it to me.