Mercedes Me Component

I’ve also changed the kPa to PSI and odometer to miles. Still new to HASS so this is helping me learn YAML & templates.

Thanks guys.

1 Like

Could you share your Mercedes image please? I’ve been trying to find one like that for ages! Thanks

1 Like

Cool! :sunglasses: keep enhancing!!:+1:t2:

Just snapshot your mercedes me app (car lock screen) and extend the canvas. That way the image will show your car model in your chosen color.

1 Like

This is my take on it:

Added a few things (sunroof status, range, background in the color of my car :smiley: ) and instead of the numerical lock status I’m using labels:

- platform: template
  sensors:
    my_car_lock_status:
      friendly_name: Vergrendelstatus
      value_template: >-
        {% if is_state('sensor.my_car_lock', '0') %}
          Open
        {% elif is_state('sensor.my_car_lock', '1') %}
          Intern vergrendeld
        {% elif is_state('sensor.my_car_lock', '2') %}
          Extern vergrendeld
        {% elif is_state('sensor.my_car_lock', '3') %}
          Selectief ontgrendeld
        {% else %}
          Onbekend
        {% endif %}
      icon_template: >
        {% if is_state('sensor.my_car_lock', '0') %}
          mdi:lock-open-variant-outline
        {% else %}
          mdi:lock-outline
        {% endif %}

The labels are based on this (from the Mercedes Me developer website):

2 Likes

Hi @DerekO,

other approach to get the image is:

  1. get a linux terminal
  2. Make sure jq and curl is installed
  3. Restart your HA (you have then 9:30 minutes to execute 4.)
  4. run the command
jq -r .access_token ~/XXX-Path-to-you-HA-config-folder-XXX/.mercedesme-token-cache | { read message; curl -v -H "Authorization: $message" -H "ris-os-name: android" -H "X-TrackingId: 8f2b839c-606e-4f87-8ca6-f5dbd131544a" -H "X-SessionId: 8f2b839c-606e-4f87-8ca6-f5dbd131544a" -H "X-Locale: de" -H "ris-sdk-version: 2.30.0" --output image.zip -L https://bff-prod.risingstars.daimler.com/v1/vehicle/XXX-VIN-XXX/topviewimage ; }

Replace XXX-Path-to-you-HA-config-folder-XXX and XXX-VIN-XXX based on your values.

Output should be an image.zip with all the relevant pictures that the app is using for the topview in the app.

BR
Rene

2 Likes

Hi Guys, having an issue creating the oAuth token, what script did you all use and where did you put it?

hi @Matt_Hayes,

do you use my component mbapi2020? Then no script is needed. Just install the component as described and then go in HA to configuration, integration and click on “+ add integration” and search for Mercedes.

BR
Rene

Looks great :+1:t2: love it! Great work on the lock status and the labels!. In the topright corner (where all the icons are) I already places a “sunroof icon” . It is the left one. Or do you mean another ? Range is cool as well. Care to share how you converted to “bar” for tire pressure?

Took some of the improvements in this post by others and added them (thank you!):

  1. replaced tire warning icon (the proper one)
  2. added liquid range
  3. added days untill service
  4. created 2 versions of the image, one with and one without a “dash speedometer” overlay just for fun.

images(transparent PNG):
updated version: https://ibb.co/qnFb5TW
updated version with “dash” overlay: https://ibb.co/6NzkJWM

PS: looking at my tire sensors, after playing around with them for a few days, I just noticed, my tires need more air :smile:

4 Likes

Works really good in Germany.
The only thing missing for me is the parking brake, but I noticed that it is also missing in the android app, so I don’t know if you can do anything about it.

My Lovelace looks like this at the moment. But I have a problem. I want every pressure reading to have 2 decimal places, even if the second one is a 0. Does anybody have an idea how I can achive that?

1 Like

I thought it made sense to also show the sunroof state like a lock, like the rest :smiley:

I created a few template sensors to show the tire pressure in bar:

- platform: template
  sensors:

    my_car_tire_pressure_rear_left:
      friendly_name: Bandenspanning linksachter
      value_template: '{{ (states.binary_sensor.my_car_tire_warning.attributes.tirepressureRearLeft / 100) | round(1) }}'
      unit_of_measurement: bar

    my_car_tire_pressure_rear_right:
      friendly_name: Bandenspanning rechtsachter
      value_template: '{{ (states.binary_sensor.my_car_tire_warning.attributes.tirepressureRearRight / 100) | round(1) }}'
      unit_of_measurement: bar

    my_car_tire_pressure_front_left:
      friendly_name: Bandenspanning linksvoor
      value_template: '{{ (states.binary_sensor.my_car_tire_warning.attributes.tirepressureFrontLeft / 100) | round(1) }}'
      unit_of_measurement: bar

    my_car_tire_pressure_front_right:
      friendly_name: Bandenspanning rechtsvoor
      value_template: '{{ (states.binary_sensor.my_car_tire_warning.attributes.tirepressureFrontRight / 100) | round(1) }}'
      unit_of_measurement: bar
1 Like

@ReneNulschDE how often is your component supposed to update? Mine isn’t doing it very often - location for example (it still thinks my car is at work, however it wasn’t there since yesterday).

Hi,

normally, the info is updated few seconds after MB reports a location change. However as I wrote in my initial announcement - The component (or better my code) has troubles to keep the connection open when the server is closing the connection. So please restart HA to get an update. I hope I can fix this over the weekend.

BR
Rene

Hi,

I don’t have some attributes in some binary sensors/sensors, like:

  • warninglowbattery
  • tankReserveLamp
  • liquidconsumptionstart

Is it normal?

Have someone the same situation?

Thanks

Restarting HA did update.

Thank you for your work and contributions.

I guess it’s normal, I do have liquidconsumptionstart but not the other two (W177/A220).

Hi,

this depends on your car model, configuration (+build year) and the money that you spend. Some cars report the lightswitchposition and other cars the Odometer only.

BR
Rene

Hi,

Thanks @ReneNulschDE and @robertklep.

I just found it strange to be just a few attributes. For example, in the warningenginelight binary sensor, I have all the attributes (warningbrakefluid, warningwashwater and warningcoolantlevellow) except the warninglowbattery.

At mercedes me app I have the battery status indication.

BR
Joca

Hi,

wait: We had this problem with the old component too that sometimes attributes are missing. I have never found a reason and flagged this as HA-magic.

Could you change the line 41 in client.py to true and restart HA? Wait until the sensors are loaded. Jump the to the messages folder in custom_components/mbapi2020 and pick the largest new json file. Search for warninglowbattery this file. Is it in the file?

Don’t forget to change the line 41 back to false.

BR
Rene