Mercedes Me Component

@exus85 How did you get the individual tyre pressure, i can see them, but cant figure out how to display them

thanks
Jody

Hi,

one option is to create a TEMPLATE sensor and fill this sensor with the value of the attribute.

Add this to your sensors in the configuration.yaml and adjust the names:

sensor:
  - platform: template
    sensors:
      lcx3025_tirepressurerearleft:
        friendly_name: tirepressureRearLeft
        value_template: "{{ states.binary_sensor.l_cx3025_tire_warning.attributes.tirepressureRearLeft }}"

this will create a normal sensor that then can be used in the different ui components.

1 Like

Thanks Rene!

Renaming the .mercedesme-token-cache and a reboot solved it.

Hi, recently when i restart Home Assistant the Mercedes Me Component it is very often failing, giving this error:

Error during setup of component mercedesmeapi
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 174, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/mercedesmeapi/__init__.py", line 95, in setup
    token_info = auth_handler.get_cached_token()
  File "/config/custom_components/mercedesmeapi/oauth.py", line 92, in get_cached_token
    token_info = json.loads(token_info_string)
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I have it installed through HACS (and i have tried reinstalling).

Hi @Konrad_Lindblad,

please delete the .mercedesme-token-cache file in your configuration directory and restart your HA. Please let me know if the error occurs again.

1 Like

Hi all,

I have been looking for this answer for some time- and I am well aware that it is right in front of me ((somewhere))! I do not have the Tirewarninglamp Binary Sensory, I can see my tire pressure values etc in the .json, so I know that they are available. I have even templated out all of the individual sensors (without values) but - I just cannot figure out how to parse the “mercedes.tirelamp?” binary sensor values. Thanks as always! So grateful for the efforts with this app!

Hi,

the TireWarningLamp is not available in all cars (some cars use tireWarningRollup as the indicator). Could you share your json-files via private message or email mbdev(at)nulsch.de.

BR
Rene

Hi @ReneNulschDE, the problem seems to occur as soon as i restart the Home Assistant container (i am using Portainer). I have to delete the cache file almost every time for it to start working again. Very strange.

Hi,

I‘m not a container specialist. But some thoughts:

Do you run the container in the right timezone and time?
Could you check if the .mercedxxx token file gets updated in your external config folder? Should happen at least once per hour.

Maybe you can share some more details of your setup. Then I and the other people here can come up with more ideas.

I have some Dev containers running but I have never seen this behavior.

BR
René

Hello,

Is your app working fine?

My app (europe region) still not working.

Thanks

Yes, but please note that the official Mercedes app has changed to another version (at least for iOS)

Thanks.
I’m using Android App and I don’t find another version.

Hi

Thanks for sharing all the info!
I jus have a question to add that maybe is also having more users from this great integration.

I just have this sensor that automatically appears from the integration

Does anyone know how to display the attributes on the Card in HA? I just able to display the KM and not the rest of attributes in my Card as you can see below
km

See below my card configuration

cards:

  • entities:
    • entity: sensor_odometer
    • entity: sensor_lock
    • entity: device_tracker
      show_header_toggle: false
      theme: Backend-selected
      title: Mercedes
      type: entities

"Hey Rene,

Sorry it has taken so long! So I tried the sensors you emailed, but it seems the issue is that I do not have ANY TireWarningLamp / tireWarningRollup Binary Sensor… In the Json files I can see that the values for the tireWarningRollup attributes are present - it just seems that a Binary Sensor was never populated.

I spent some time this evening trying figure out what I’m missing, but no luck! I just wanted to post here incase anyone else is having this problem.

Of note, when I first installed the integration I noticed that I had setup my config as:

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… for debug only
tire_warning: tireWarningRollup. <<-------

Not sure if this matters, I am now taking it out and rebooting - so I will let you know!
I will email you back as well - feel free to reply either way. Your awesome feedback is always very appreciated!

Hi @simposium,

there are multiple options available:

  1. If you have the current HA version (>=0.108) in use, you can use the new “Entity” card.

  2. You can also configure a template sensor. See here for more help. Example:

  - platform: template
    sensors:
      lcx3025_tirepressurerearleft:
        friendly_name: tirepressureRearLeft
        value_template: "{{ states.binary_sensor.l_cx3025_tire_warning.attributes.tirepressureRearLeft }}"
      lcx3025_tanklevel:
        friendly_name: Tank Level
        value_template: "{{ states.sensor.l_cx3025_odometer.attributes.tanklevelpercent }}"
        unit_of_measurement: "%"
  1. Or you use custom lovelace cards. There are multiple cards available like “entity-attributes-card
    Example:
type: 'custom:entity-attributes-card'
title: L-CX 3025
heading_name: List
heading_state: States
filter:
  include:
    - key: sensor.l_cx3025_odometer.*

Result:

if you would like to see all attributes:

type: 'custom:entity-attributes-card'
title: L-CX 3025
heading_name: List
heading_state: States
filter:
  include:
    - key: sensor.l_cx3025*.*
    - key: binary_sensor.l_cx3025*.*
  exclude:
    - key: binary_sensor.l_cx3025*.car*
    - key: binary_sensor.l_cx3025*.retr*
    - key: binary_sensor.l_cx3025*.frien*

Hi

Apreciated your help!! Now work as expected :slight_smile:

coche_stats

1 Like

I have installed this component and was able to pull the information fine. What is unclear to me is home often the integration pulls updates. Most of the values show many hours have elapsed between an update. I took the car for a drive and it did not update my location. Had to restart Home Assistant to update KM.

Hi, the component is updated every 30 seconds in the default configuration. The location of your car is send from your car to the Mercedes Server around every two minutes. Window or door status is send by your car to the servers more or less real time.

Do you see any errors in your log file?

Is your car in Europe or North America?

What is your current HA version?

Running latest version 108.9. In Canada but as instructed have it configured to country US.

I rebooted HA and it maybe working now. I did take the car out to Starbucks today and do see the Status changed from Home to Away for that period of time.

I have logging turned on and do see updates every 30 secs in the Home Assistant Log file.

Should I assume the “5 Hours Ago” reference (see image) is the last time the value changed state vs it was updated?

Screen Shot 2020-04-29 at 2.15.46 PM

Yes, the time is updated on status change only.

However it looks like that the API has changed on the server side. At least for my car the unlocking feature does not work currently.

can anyone else check the unlock feature?