Mercedes Me Component

It seems like the access token is no longer stored in the HA config root folder.
I dimly remember a changelog about that…
Maybe @ReneNulschDE can weight in on that?

Also, you need the file, not a shell to HA. You can get files off HA either via Studio Code Server, or Samba share.

I did read that HA and ssh had changes over the year, what is currently working in my installation is the “Terminal & SSH” Add-On from the official add-on store. I do run HAOS in a VM.

1 Like

MB and I made a lot of changes since this posting and I assume its easier to have a service to download the images. I’m currently implementing this and will publish a beta later today.

In the beta you will see a new service mbapi2020.download_images. It will require the VIN. After starting the service a zip-file will be available locally.

2 Likes

Supporting the great post from @Thomas01, I have published a new beta version “v0.14.0-beta.1 - AdBlue Sensor, Images download”:

New:

  • New service “download_images”. This service will download a zip-file from the MB-servers with images (of your car of course) (to custom_components/mbapi2020/resources/vin.zip) that Thomas used in his post
  • New sensor “tankleveladblue”. Shows the level of the AdBlue tank in %.

Fixes:

  • Next try on the ReAuth issue. (I can’t reproduce it and changed the logic a little bit)
3 Likes

Thanks, updated my post above.

I am interested in the sideview car, it fits better.

Picture Element card - Sideways orientation

In my previous post, I described how to use picture elements to generate a view similar to the MercedesMe app (in an “upright” view), with the help of the images provided by Mercedes Benz.
Now to continue with a rotated, “sideview” version:
sideways view

Let’s start with the

Requirements

The set-up of the sensors is the same as with the upright version, so start there.

The difference starts with the supplied images. The CSS of the picture elements card take care of rotating the images, except for the background image (XXXXXX_car.png), which needs to be rotated using your favourite image manipulation programme (GIMP comes to mind). I called the rotated image XXX_car_rotate.png in my case.

Also, only the window_right_*.png images are used for the states of the windows.

Picture Elements card

Just as before (replace all the 297100 in the filenames to your filenames of the downloaded zip from earlier, and XXX with your car name), except that now a rotate command is added (and some coordinates change).

type: picture-elements
image: local/eqs/297100_car_rotate.png
elements:
  - type: image
    entity: sensor.eqs_door_frontleft
    state_image:
      Open: local/eqs/297100_door_frontleft_open.png
      Unlocked: local/eqs/297100_door_frontleft_unlock.png
      Locked: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
  - type: image
    entity: sensor.eqs_window_frontleft
    state_image:
      OpenDC: local/eqs/297100_window_frontleft_opendoorclosed.png
      OpenDO: local/eqs/297100_window_frontleft_opendooropened.png
      VentDC: local/eqs/297100_window_frontleft_ventilatedoorclosed.png
      VentDO: local/eqs/297100_window_frontleft_ventilatedooropened.png
      Closed: null
      Moving: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
  - type: image
    entity: sensor.eqs_door_frontright
    state_image:
      Open: local/eqs/297100_door_frontright_open.png
      Unlocked: local/eqs/297100_door_frontright_unlock.png
      Locked: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
  - type: image
    entity: sensor.eqs_window_frontright
    state_image:
      OpenDC: local/eqs/297100_window_frontright_opendoorclosed.png
      OpenDO: local/eqs/297100_window_frontright_opendooropened.png
      VentDC: local/eqs/297100_window_frontright_ventilatedoorclosed.png
      VentDO: local/eqs/297100_window_frontright_ventilatedooropened.png
      Closed: null
      Moving: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
  - type: image
    entity: sensor.eqs_door_rearleft
    state_image:
      Open: local/eqs/297100_door_rearleft_open.png
      Unlocked: local/eqs/297100_door_rearleft_unlock.png
      Locked: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
  - type: image
    entity: sensor.eqs_window_rearleft
    state_image:
      OpenDC: local/eqs/297100_window_rearleft_opendoorclosed.png
      OpenDO: local/eqs/297100_window_rearleft_opendooropened.png
      VentDC: local/eqs/297100_window_rearleft_ventilatedoorclosed.png
      VentDO: local/eqs/297100_window_rearleft_ventilatedooropened.png
      Closed: null
      Moving: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
  - type: image
    entity: sensor.eqs_door_rearright
    state_image:
      Open: local/eqs/297100_door_rearright_open.png
      Unlocked: local/eqs/297100_door_rearright_unlock.png
      Locked: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
  - type: image
    entity: sensor.eqs_window_rearright
    state_image:
      OpenDC: local/eqs/297100_window_rearright_opendoorclosed.png
      OpenDO: local/eqs/297100_window_rearright_opendooropened.png
      VentDC: local/eqs/297100_window_rearright_ventilatedoorclosed.png
      VentDO: local/eqs/297100_window_rearright_ventilatedooropened.png
      Closed: null
      Moving: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
  - type: image
    entity: sensor.eqs_sunroof
    state_image:
      open: local/eqs/297100_sunroof_open.png
      vent: local/eqs/297100_sunroof_ventilate.png
      closed: null
      moving: local/eqs/297100_sunroof_open.png
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
  - type: image
    entity: sensor.eqs_trunk
    state_image:
      open: local/eqs/297100_trunk_open.png
      unlocked: local/eqs/297100_trunk_unlock.png
      closed: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
  - type: image
    entity: sensor.eqs_window_frontleft
    title: Front Left
    state_image:
      OpenDC: local/eqs/window_right_open.png
      OpenDO: local/eqs/window_right_open.png
      VentDC: local/eqs/window_right_vent.png
      VentDO: local/eqs/window_right_vent.png
      Closed: local/eqs/window_right_closed.png
      Moving: local/eqs/window_right_moving.png
    style:
      top: 24%
      left: 56%
      transform: translate(-50%,-50%)
    tap_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        front_left: '0'
    hold_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        front_left: '10'
    double_tap_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        front_left: '100'
  - type: image
    entity: sensor.eqs_window_frontright
    title: Front Right
    state_image:
      OpenDC: local/eqs/window_right_open.png
      OpenDO: local/eqs/window_right_open.png
      VentDC: local/eqs/window_right_vent.png
      VentDO: local/eqs/window_right_vent.png
      Closed: local/eqs/window_right_closed.png
      Moving: local/eqs/window_right_moving.png
    style:
      top: 76%
      left: 56%
      transform: translate(-50%,-50%)
    tap_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        front_right: '0'
    hold_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        front_right: '10'
    double_tap_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        front_right: '100'
  - type: image
    entity: sensor.eqs_window_rearleft
    title: Rear Left
    state_image:
      OpenDC: local/eqs/window_right_open.png
      OpenDO: local/eqs/window_right_open.png
      VentDC: local/eqs/window_right_vent.png
      VentDO: local/eqs/window_right_vent.png
      Closed: local/eqs/window_right_closed.png
      Moving: local/eqs/window_right_moving.png
    style:
      top: 24%
      left: 39%
      transform: translate(-50%,-50%)
    tap_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        rear_left: '0'
    hold_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        rear_left: '10'
    double_tap_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        rear_left: '100'
  - type: image
    entity: sensor.eqs_window_rearright
    title: Rear Right
    state_image:
      OpenDC: local/eqs/window_right_open.png
      OpenDO: local/eqs/window_right_open.png
      VentDC: local/eqs/window_right_vent.png
      VentDO: local/eqs/window_right_vent.png
      Closed: local/eqs/window_right_closed.png
      Moving: local/eqs/window_right_moving.png
    style:
      top: 76%
      left: 39%
      transform: translate(-50%,-50%)
    tap_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        rear_right: '0'
    hold_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        rear_right: '10'
    double_tap_action:
      action: call-service
      service: mbapi2020.windows_move
      data:
        vin: W1KXXXXXXXXXXXXXX
        rear_right: '100'
  - type: state-label
    entity: sensor.XXX_tire_pressure_front_left
    title: Front Left
    style:
      top: 34%
      left: 77%
      transform: translate(-50%,-100%)
  - type: image
    entity: sensor.eqs_tire_image_frontleft
    state_image:
      Warning: local/eqs/297100_tire_frontleft.png
      OK: null
    title: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
  - type: state-label
    entity: sensor.XXX_tire_pressure_front_right
    title: Front Right
    style:
      top: 66%
      left: 77%
      transform: translate(-50%,0%)
  - type: image
    entity: sensor.eqs_tire_image_frontright
    state_image:
      Warning: local/eqs/297100_tire_frontright.png
      OK: null
    title: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
  - type: state-label
    entity: sensor.XXX_tire_pressure_rear_left
    title: Rear Left
    style:
      top: 34%
      left: 26%
      transform: translate(-50%,-100%)
  - type: image
    entity: sensor.eqs_tire_image_rearleft
    state_image:
      Warning: local/eqs/297100_tire_rearleft.png
      OK: null
    title: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
  - type: state-label
    entity: sensor.XXX_tire_pressure_rear_right
    title: Rear Right
    style:
      top: 66%
      left: 26%
      transform: translate(-50%,0%)
  - type: image
    entity: sensor.eqs_tire_image_rearright
    state_image:
      Warning: local/eqs/297100_tire_rearright.png
      OK: null
    title: null
    style:
      top: 0%
      left: 0%
      transform: translate(0, 0) rotate(0.25turn)
    tap_action:
      action: none
4 Likes

Thanks @ReneNulschDE and @Thomas01 for the excellent work, ran the beta, got the images, followed Thomas’ tutorial and it all seems to be up and running (haven’t fiddled with the status of doors and windows yet, will do so another day).

1 Like

Pics!

Would love to see other peoples implementation of status/control cards. Especially if they are image based.


Here you go!
there’s another card with efficiency, range etc but that contains my license plate so I’ve kept that out.

1 Like

Nice.
What are the wiggly lines on the hood?
And the Eco Scores look a bit like the Apple fitnes rings. How did you do the rings?

Thanks!

The wiggly lines are the preconditioning of the car - rather important when my better half wants to use the car during colder days :slight_smile:
The ring graph is made with the custom apexcharts card.

I might try and play around to change the colour of the car to the actual colour of mine (black) and also redistribute the icons to make it look more ‘balanced’…

Hi All and first a big thank you to @ReneNulschDE and @Thomas01 for their combined effort! I just installed the newest beta version v0.14.0-beta.1 and tried downloading the images. Unfortunately I got this error: Given VIN/FIN is not managed by any coordinator or excluded in the integration options.

What am I doing wrong?

1 Like

First guess: The VIN/FIN needs to be in upper case or you have a typo. (Just copy the FIN from one existing sensor - see the attributes list)

That’s what I did in the first time. Second time exactly the same and now it works. Thanks!

1 Like

First of all: Thanks for this great add-in.It is working here since some months and most of the time without any problems.

Here was a stupid beginners question before.
Sorry for that, i found the solution myself :slight_smile:

1 Like

Hi guys,

Thanks for the composent ! everything is OK but in my configuration i cant find the file mercedesme-token-cache for get zip from mercedes

i try to delete and add it’s the same …

Hi Matt, the file is in .storage folder in you HA-config folder.

You could install v0.14.0-beta1 too, this version has a HA-Service to download the file.

Thank’s Rene, now its perfect !

1 Like

HI there:

I need help in creating a template switch for the preconditioning, but it doesn’t work at all…
If I call the service manually to start for instance, nothing happens in the car. Also vice versa, the attributes in the range_electric sensor are not updated, if I switch preconditioning “on” in MercedesMe app. Something is odd.

Interestingly the buttons in the overview to start/stop preconditioning are working fine…
Not sure if my changes in configuration.yaml are ok in principle.

standheizung_glc:
value_template: "{{ is_state_attr('sensor.ohv_g513e_range_electric', 'PrecondActive', 'on') }}"
turn_on:
service: mbapi2020.auxheat_start
data:
vin: W1N253xxxxxxxxxxxxx
turn_off:
service: mbapi2020.auxheat_stop
data:
vin: W1N253xxxxxxxxxxxxx

This is my switch definition (it works on my car):

switch:
  - platform: template
    switches:
      eqs_precond:
        friendly_name: Pre-entry Climate Control
        value_template: "{{ state_attr('sensor.XXX_range_electric', 'precondNow') or state_attr('sensor.XXX_range_electric', 'precondActive') }}"
        icon_template: mdi:air-conditioner
        turn_on:
          service: mbapi2020.preheat_start
          target: {}
          data:
            vin: "{{ state_attr('sensor.XXX_car', 'vin') }}"
            type: "0"
        turn_off:
          service: mbapi2020.preheat_stop
          target: {}
          data:
            vin: "{{ state_attr('sensor.XXX_car', 'vin') }}"

Do you have the indentation right?

EDIT: Thats at least how it works with my electric car, I don’t know if a gasoline (or hybrid) car behaves differently. Ie. auxheat_start vs preheat_start.

2 Likes