Mercedes Me Component

New Version 0.1.9 - Added Electric Sensors:

  • electric_consumption_reset
  • electric_consumption_start
  • electric_distance_ctritical_reset
  • electric_distance_since_start
  • electric_range_skip_indicator

I do not have a hybrid car (only a devil diesel), i could not test this.

If you would like to hide these sensor please use the normal home-assistant customize configuration and hide the sensors.
Sample

sensor.[licenseplate]_electric_consumption_reset:
  hidden: true

Auto Updater should show the new version…

same like the heater… I’m sure it exists but don’t know how to call. I’ll take a look in the old android apks.

2 Likes

Thanks for the Automations, were just about to make one for me.

I don’t quite get it to work, took me awhile to figure out, you also need input_number but still it will not work.

input_number:
  monthly_mileage:
    name: Whatever
    min: 0
    max: 100000
    step: 1

- alias: Monthly Mileage
  trigger:
    platform: time
    at: '00:00:00'
  condition:
      - condition: template
# Change the number here to get whatever day of the month you want.
        value_template: “{{ now().day == 1 }}”
  action:
    service: input_number.set_value
    data_template:
      entity_id: input_number.monthly_mileage
      value: “{{ states.sensor.XXXXXX_odometer.state }}”

Been trying this tonight and change day == 2 and proper time but it will not fire.

@ReneNulschDE Would be great if you find the heater, I can test it for my mb (that also is diesel :wink: ) Also, how can I see that the custom updater have updated files ?

1 Like

Heyyyy!!! It’s back!

I have a hybrid, glc350e. Anything you need to know, please ask. However, I’m not a programmer, so anything technical like explaining to a baby.

Bad news about hybrid part:
electric_consumption_reset: -
electric_consumption_start: -
electric_distance_ctritical_reset: error
electric_distance_since_start: error
electric_range_skip_indicator: error

…and I’m supercurious about the heating/cooling control through HA.

This is my code:

monthly_mileage_feb:
name: monthly Mileage
min: 0
max: 99999999

  • alias: Februari Mileage
    trigger:
    platform: time
    at: ‘00:00:00’
    condition:
    - condition: template
    # Change the number here to get whatever day of the month you want.
    value_template: “{{ now().day == 1 and now().month == 2 }}”
    action:
    service: input_number.set_value
    data_template:
    entity_id: input_number.monthly_mileage_feb
    value: “{{ states.sensor.tg_XXX_k_odometer.state }}”

Where do you enter that “monthly_mileage_feb:” part? I just get errors if it’s in automation.yaml…

Btw, I have a leasing car with a mileage limit. I’m interested about predicting my mileage in three years to avoid additional costs. So I have a telegram status report which makes the estimate:
{{ ((states('sensor.odometer') | int) / (((states('sensor.date')[:-6] | int - 2017) * 365 + (states('sensor.date')[-5:-3] | int - 10) * 30 + (states('sensor.date')[-2:] | int - 13)) / 1095)) | int }}
…simple odometer divided by (days-in-use / 1095), where 1095=3*365.

However, it’d be interesting to make a history graph of the estimate instead of just spot reports. How can one enter such formulae to history graphs?

I found the issue, when I copied you automation the qutotationmarks got
wrong

Wrong:
{{ now().day == 1 }}”

Correct:
"{{ now().day == 1 }}"

I have it running together with IFTT and save data to Google Sheets.

Good work!

I’ve having trouble getting this to work.
This is my log:

2019-02-04 19:54:41 INFO (SyncWorker_9) [mbwebapppy.controller] Login step 2 http code 200
2019-02-04 19:54:42 INFO (SyncWorker_9) [mbwebapppy.controller] Login step 3 http code 404
2019-02-04 19:54:42 ERROR (MainThread) [homeassistant.setup] Error during setup of component mbwebbeta
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/setup.py”, line 148, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/mbwebbeta.py”, line 167, in setup
mercedesme_api = Controller(username, password, scan_interval)
File “/config/deps/lib/python3.6/site-packages/mbwebapppy/controller.py”, line 212, in init
self._get_cars()
File “/config/deps/lib/python3.6/site-packages/mbwebapppy/controller.py”, line 265, in _get_cars
response.content.decode(‘utf8’))[‘vehicles’]
File “/usr/local/lib/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/local/lib/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/local/lib/python3.6/json/decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

You have to accept the data policy.

Please try the following URL to login:
https://app.secure.mercedes-benz.com/session/login?app-id=VHPMBCON.PRODEC

Accept the data policy.

After that use this link to check if we find some cars in your account:
https://app.secure.mercedes-benz.com/backend/users/identity

restart your HA. Should work now.

When i click the link i’m asked to login. I put in my “mercedes me” app email and pass and i get 404

# Not Found

The requested URL /app/ciam/success.html was not found on this server.

The 2nd link obviously doesn’t work either. I get

Not Found / Details (optional): com.daimler.daivb.cpp.exceptions.CppUserNotFoundException: CIAM user with id xxx not found in CPD.

The 404 is normal because they have removed the webapp. The second error is the problem. Never have seen this before. Could you login in the normal mb portal with this user and password?

What is your country location?

I’m never presented with any data policy to accept after doing the first url.

And yes I can use the mb portal
this one
https://login.secure.mercedes-benz.com/wl/login
and
https://www.mbusa.com/mercedesme/index

Both show my car (2018 c300)

as well as the “Mercedes Me” app on my android

oh and I’m in USA

Hi, that should be the problem. This works in Europe and Asia only.

Sorry
René

Bummer :frowning: I wonder if it can be fooled with vpn or does it check the car’s registration location. Gonna play around with some vpns tomorrow.

MBUSA has a different implementation. That was a problem in the first version too. VPN will not help here. Looks like they have different datastore.

thanks, ya I just read Mercedes connected vehicle API docs. No dice for us in US right now :frowning: hopefully they’ll add it at some point.
I messed around with it a bit more and got it to give me the data consent screen etc but when you query it for vehicles it doesn’t find anything :frowning:

Looks like MB has disabled the API endpoint yesterday afternoon. :rage:

What a shame :frowning: The component was working so good.

Whaaa to get crazy! Why Why Why

Even my mobile app doesn’t work any longer, apparently they closed all api’s. The car is nice, but the way MB handles software (api, mobile, in-car)… I haven’t seen as poor performance probably ever.