homebridge-mercedesme

homebridge-mercedesme

Usage no npm install needed!

<script type="module">
  import homebridgeMercedesme from 'https://cdn.skypack.dev/homebridge-mercedesme';
</script>

README

homebridge-mercedesme

npm npm GitHub last commit verified-by-homebridge Discord Donate

Creating and maintaining Homebridge plugins consume a lot of time and effort, if you would like to share your appreciation, feel free to "Star" or donate.

Click here to review more of my plugins.

Info

Apple Home

This dynamic platform plugin allows control of Mercedes Me capable cars. At the moment it is only possible to get information like vehicle status, lock status, fuel status etc. If in the future the possibility of e.g. locking or unlocking the car becomes possible, this will also be implemented.

Any system capable of running Homebridge can be used to run homebridge-mercedesme. The only need is Mercedes Me capable car.

Installation instructions

After Homebridge has been installed:

sudo npm install -g homebridge-mercedesme@latest

First steps (obtain Client ID and Client Secret)

In order to use this plugin, you must first log in with your Mercedes Me account on Mercedes Developer. After logging in go to Console and press on Add new app if you dont have already an existing app for this plugin.

Enter Application Name (e.g. Homebridge) Business Purposes (e.g. homebridge-mercedesme) and press Create

Now we need to add the API endpoints to our App.

  1. Visit Vehicle Status API and press Get access.
  2. Choose Bring your own car and press Next
  3. Choose Standard and press Next
  4. Choose your existing app and press Next
  5. On Edit Application leave everything as it is and press Submit

Congratulation. Now you have added the Vehicle Status endpoint to your app. You need also to add Lock Status endpoint, Pay as your drive endpoint, Electric Vehicle Status endpoint and Fuel status endpoint to your app by following the above steps.

Requested endpoints:

Once you have added all the API endpoints to your application, visit Console again. You should see your Client ID, Client Secret and Redirect Url.

Important

Add your Config UI X ip address with port as your Redirect Url (eg http://192.168.178.11:8080). If you have multiple ip addresses to your config ui x, please add them all as redirect uri !

Copy your Client ID and Client Secret and put it in your config.json (Config UI > Plugins > Homebridge Mercedesme Settings > Client ID/Client Secret)

First start

The Version 2 is completely new designed. It supports Config UI X Plugin UI Utils and is full integrated in your homebridge system via Config UI X. The custom config will guide you through the process! Generating or refreshing access token was never easier! Below you can see how easy it is to create, edit or delete a new car for the config.json using the custom user interface. To use the custom user interface you need at least homebridge-config-ui-x v4.34.0!

CustomUI

Configuration

Please setup your config in Config UI X under Plugins > Homebridge Mercedes Me > Settings.

Example config.json:

{
  "bridge": {
      ...
  },
  "platforms": [
    {
      "platform": "MercedesPlatform",
      "debug": false,
      "cars": [
        {
          "name": "Mercedes A200",
          "clientID": "1b851746-2x58-7y8r-6548-12ft58w159zu",
          "clientSecret": "d896ct55-c85c-6363-9999-25iu6985mo10",
          "vin": "WDD1234567N123456",
          "model": "Mercedes A200",
          "manufacturer": "Mercedes",
          "maxRange": 800,
          "polling": 60,
          "tankBatteryType": "LIGHTBULB"
        },
        {
          "name": "Mercedes CLA250",
          "clientID": "1b851746-2x58-7y8r-6548-12ft58w159zu",
          "clientSecret": "d896ct55-c85c-6363-9999-25iu6985mo10",
          "vin": "WDD1234567N123456",
          "model": "Mercedes B180",
          "manufacturer": "Mercedes",
          "maxRange": 600,
          "polling": 120,
          "electricVehicle": true,
          "tankBatteryType": "HUMIDITY"
        },
        {
          "name": "Mercedes B200",
          "clientID": "1b851746-2x58-7y8r-6548-12ft58w159zu",
          "clientSecret": "d896ct55-c85c-6363-9999-25iu6985mo10",
          "vin": "WDD1234567N123456",
          "model": "Mercedes B180",
          "manufacturer": "Mercedes",
          "maxRange": 600,
          "polling": 120,
          "hybridVehicle": true,
          "tankBatteryType": "HUMIDITY"
        }
      ]
    }
  ]
}

See Example Config for more details.

Settings

  • platform - required : Must be 'MercedesPlatform'
  • cars.name - required : Name of the Accessory (unique)
  • cars.clientID - required : Client ID obtained from https://developer.mercedes-benz.com
  • cars.clientSecret - required : Client Secret obtained from https://developer.mercedes-benz.com
  • cars.vin - required : Vehicle Identification Number (VIN)
  • cars.manufacturer - not required : Car Manufacturer
  • cars.model - not required : Model of the car (Default: Mercedes)
  • cars.maxRange - not required : Maximum distance after full tank load (for calculating range in % for battery state if API doesnt send the percentage)
  • cars.polling - not required : Time in seconds for polling Mercedes API (Default: 60s)
  • cars.electricVehicle - not required : Enable if your car is a electric vehicle (Default: false)
  • cars.hybridVehicle - not required : Enable if your car is a hybrid vehicle (Default: false)
  • cars.tankBatteryType - not required : Choose between several accessory types (HUMIDITY | LIGHTBULB) to show the remaining tank load and/or electric vehicle battery value in percent

Supported clients

This plugin has been verified to work with the following apps on iOS 14:

  • Apple Home
  • All 3rd party apps like Elgato Eve etc.
  • Homebridge >= v1.1.6

TODO

  • If it should be possible to control the doors in the future > Changing Door (Contact Service) to Door Service
  • If it should be possible to control the windows in the future > Changing Window (Contact Service) to Window Service

Troubleshooting

If you have any issues with the plugin, you can enable the debug mode, which will provide some additional information. This might be useful for debugging issues. Open your config.json and set "debug": true

Token Issues

If you experiencing issues with your generated token, you can easily refresh it via Config UI X. Below you can see how to do it.

CustomUI Refresh Token

Changelog

See the changelog for changes between versions of this package.

Contributing

You can contribute to this homebridge plugin in following ways:

  • Report issues and help verify fixes as they are checked in.
  • Review the source code changes.
  • Contribute bug fixes.
  • Contribute changes to extend the capabilities
  • Pull requests are accepted.

Disclaimer

All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.