Mercedes Me Component

regarding the lock status being 2, i’ve added the following to my yaml file:

      car_lock_status:      
        friendly_name: Car Lock Status
        value_template: >-
            {% if is_state('sensor.g_646_lz_lock', '2')%}
                Closed
            {% else %}
                Open
            {% endif %}

and then this on my dashboard:

- entity: sensor.car_lock_status
    prefix: ''
    style:
      color: '#FFFFFF'
      left: 11%
      top: 64%
    type: state-label

after restarting i then got “Closed or Open” after the lock symbol.

Hi Rene,

I guess you have quoted me by accident here.

But I can document the values for chargingstatus here for others who may want to use it. This was done by comparing to the mercedes me app:

chargingstatus = 0 means charging
chargingstatus = 1 means charging finished
chargingstatus = 2 ?? unknown
chargingstatus = 3 means charging cable disconnected
chargingstatus = 4 means charging error

Not sure about “2” and other potential states (5,6, …) though.

Maybe you can add that to the README @

Let me share my Mercedes dashboard here in the hope that it will be an inspiration for other implementations. Not super pretty and some logic is implemented in nodered, but you may get the idea.

Not charging:

Charging:

I have a Shelly Plug S deployed to start / stop charging that gives me the wattage and temperature and can be switched on/off. The end time is calculated from the range_electric sensor using nodered.

6 Likes

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).