Mercedes Me Component

Are you willing to share your config with us? Would be really great!

I can if you are interested. At the moment i’m on vacation in the US. When i’m back home in June i can try to separate the relevant codelines and post them here.

2 Likes

Enjoy your holidays.

Btw: I have access to some other apis now. Let us see what we can do with these apis. Maybe we find the access to the locks & heaters here :wink:

5 Likes

That would be really great. Have a good vacation!

Short status update:

  • It is definitely time to set-up a pin in your MB-App :slight_smile:

door-status-1 door-status-2

4 Likes

Is this available now?

Can’t wait :slight_smile:

Give me some time to make the code more robust and let me add the heater :slight_smile:

2 Likes

Hi ReneNulschDE,

Thanks for your great work. I have one question, I have a Mercedes GLC 2018 china model.
I’m wondering how to modify your component to support connecting to it.
Maybe you can give me some clue.

What type of apps or webapps you could use in China currently?

Hi ReneNulsachDE
I’m using Mercedes Me Chinese version, looks like it is only web-pages being wrapped in a Android APK.


Hi,

I’m polishing the code currently and at least the OAuth process and the locks working as normal custom_component. I found already someone who is allowing me to access his car to build the heater switch.

Is anybody with a electric car willing to add my account as second user (currently only in europe)? My car hasn’t this feature and I would like to check the sensors.

Please send me a private message and I’ll share my account address.

Thank you
Rene

1 Like

Hi, leiduke. Let me check. I’m finalizing a new version for Europe currently and after I have finished this, I’ll take a look on this.

3 Likes

Really cool that people help with the development by giving access to their car. I don’t have an electric verhicle so can’t really help.

2 Likes

I have pushed a first version of a new component to

Please remove the old component from your config before you test this. This component is using a complete different approach to access the APIs.

This is an initial test release. Please expect some bugs.

This component will work in Europe onlyEurope and US.

Thank you to the different people who shared their data with me.

mbapipy

MercedesME platform as a Custom Component for Home Assistant.

Remove other MercedesMe components before use of this one.

Configuration:

mercedesmeapi:
  username: YOUR_USERNAME
  password: YOUR_PASSWORD

Optional configuration values

mercedesmeapi:
  username: YOUR_USERNAME
  password: YOUR_PASSWORD
  pin: XXXX                      # need to open the lock, please use the Mercedes web or app to set-up the pin
  
  country_code: DE               # two digts country code
  accept_lang: en_DE             # four digits country code
  save_car_details: true         # save a json to the HA config directory with the features and states, please use this for debug only 

Available components:

  • Lock

  • Aux Heat Switch

  • Binary Sensors:

- warningenginelight
  attributes: warningbrakefluid, warningwashwater, warningcoolantlevellow, warninglowbattery

- parkbrakestatus
  attributes: preWarningBrakeLiningWear

- windowsClosed
  attributes: windowstatusrearleft, windowstatusrearright, windowstatusfrontright, windowstatusfrontleft

- tirewarninglamp
  attributes: tirepressureRearLeft, tirepressureRearRight, tirepressureFrontRight, tirepressureFrontLeft, tirewarningsrdk, tirewarningsprwtireMarkerFrontRight, tireMarkerFrontLeft, tireMarkerRearLeft, tireMarkerRearRight, tireWarningRollup, lastTirepressureTimestamp
  • Sensors:
- lock
  attributes: doorStateFrontLeft, doorStateFrontRight, doorStateRearLeft, doorStateRearRight, frontLeftDoorLocked, frontRightDoorLocked, rearLeftDoorLocked, rearRightDoorLocked, frontLeftDoorClosed, frontRightDoorClosed, rearLeftDoorClosed, rearRightDoorClosed, rearRightDoorClosed, doorsClosed, trunkStateRollup, sunroofstatus

- rangeElectricKm
  attributes: rangeelectric, rangeElectricKm, criticalStateOfSoc, maxrange, stateOfChargeElectricPercent, endofchargetime, criticalStateOfDeparturetimesoc, warninglowbattery, electricconsumptionreset, maxStateOfChargeElectricPercent, supplybatteryvoltage, electricChargingStatus, chargingstatus, soc, showChargingErrorAndDemand, electricconsumptionstart
  
- auxheatstatus
  attributes: auxheatActive, auxheatwarnings, auxheatruntime, auxheatwarningsPush, auxheattimeselection, auxheattime1, auxheattime2, auxheattime3

- tanklevelpercent

- odometer
  attributes: distanceReset, distanceStart, averageSpeedReset, averageSpeedStart, distanceZEReset, drivenTimeZEReset, drivenTimeReset, drivenTimeStart, ecoscoretotal, ecoscorefreewhl, ecoscorebonusrange, ecoscoreconst, ecoscoreaccel, gasconsumptionstart, gasconsumptionreset, gasTankRange, gasTankLevel, liquidconsumptionstart, liquidconsumptionreset, liquidRangeSkipIndication, rangeliquid, serviceintervaldays, tanklevelpercent, tankReserveLamp
  

Logging:
Set the logging to debug with the following settings in case of problems.

logger:
  default: warn
  logs:
    custom_components.mercedesmeapi: debug
    custom_components.mercedesmeapi.sensor: info
    custom_components.mercedesmeapi.apicontroller: debug
    custom_components.mercedesmeapi.OAuth: debug
3 Likes

happy to test :grinning:

I checked my password which is valid.
> 2019-06-04 16:23:09 ERROR (MainThread) [homeassistant.setup] Error during setup of component mercedesmeapi
> Traceback (most recent call last):
> File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py”, line 156, in _async_setup_component
> component.setup, hass, processed_config) # type: ignore
> File “/usr/local/lib/python3.6/asyncio/futures.py”, line 331, in iter
> yield self # This tells Task to wait for completion.
> File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 244, in _wakeup
> future.result()
> File “/usr/local/lib/python3.6/asyncio/futures.py”, line 244, in result
> raise self._exception
> File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
> result = self.fn(*self.args, **self.kwargs)
> File “/home/homeassistant/.homeassistant/custom_components/mercedesmeapi/init.py”, line 195, in setup
> from custom_components.mercedesmeapi.OAuth import MercedesMeOAuth
> ModuleNotFoundError: No module named ‘custom_components.mercedesmeapi.OAuth’

hi,

did you changed the naming of the OAuth.py to oauth.py.

Please use the same naming like in the GitHub-repo. Change your oauth.py to OAuth.py

using venv hass version installed on raspbian

I did a git clone and copied the files, as you see on the screenshot above it’s already all in lowercase

please change to OAuth.py. I’ll change all to lower case later.

some progress but still errors:

019-06-04 16:49:12 DEBUG (SyncWorker_17) [custom_components.mercedesmeapi.apicontroller] _get_car_features for WDD2052441F857325 called
2019-06-04 16:49:12 DEBUG (SyncWorker_17) [custom_components.mercedesmeapi.apicontroller] Connect to URL get https://bff.meapp.secure.mercedes-benz.com/api/v2/dashboarddata/WDDxxxx/vehicle
2019-06-04 16:49:13 ERROR (MainThread) [homeassistant.setup] Error during setup of component mercedesmeapi
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/mercedesmeapi/__init__.py", line 228, in setup
    conf.get(CONF_SAVE_CAR_DETAILS))
  File "/home/homeassistant/.homeassistant/custom_components/mercedesmeapi/apicontroller.py", line 281, in __init__
    self._get_cars()
  File "/home/homeassistant/.homeassistant/custom_components/mercedesmeapi/apicontroller.py", line 377, in _get_cars
    car.features = self._get_car_features(car.finorvin)
  File "/home/homeassistant/.homeassistant/custom_components/mercedesmeapi/apicontroller.py", line 463, in _get_car_features
    with open('{0}/feat_{1}.json'.format('/config',car_id), 'w') as outfile:
FileNotFoundError: [Errno 2] No such file or directory: '/config/feat_WDDxxxx.json'