Mercedes Me Component

Have you read this post? Mercedes Me Component

1 Like

@robertklep grinning: <-- Blushing
Actually searched through posts to find a similar problem, seems i didn’t do a good job.

No i have not. I updated to the prerelease and now it is working.

Thanks for the help :wink:

1 Like

I have published a new Prerelease Version. With this change the login should work in all regions again.

3 Likes

Hi,

I have published a new stable release v0.5.2. With this release a re-authentication is needed as MB has changed their login endpoints. This should not break your existing configuration. The sensors will get the same IDs.

Fix:

  • New Authentication End-Points

New:

  • Re-authentication is requested via the integration page when the authentication does not work on HA restart. After the ReAuth the component gets loaded automatically.

User Interface:

Screenshot from 2021-03-13 17-03-02

Screenshot from 2021-03-13 17-03-25

6 Likes

Your card looks really cool. Could you please share this card yaml configuration with aux heating activation/deactivation and lock control?

Thanks. I couldn’t get it all to work using yaml so a couple of entities are created in node red.
Obviously credit to Ronin @Mobiledude for doing the heavy lifting.

sensor:
  - platform: template
    sensors:
      car_lock_status:      
        friendly_name: Car Lock Status
        value_template: >-
            {% if is_state('sensor.wd70kwf_lock', '2')%}
                Locked
            {% else %}
                Open
            {% endif %}
      car_status_update:
        friendly_name: Car Status
        value_template: '{{ states.sensor.wd70kwf_car.attributes.last_message_received }}'
      car_status_message:
        friendly_name: Last Message
        value_template: '{{ states.sensor.wd70kwf_car.attributes.last_command_type }}'
      car_soc:
        friendly_name: State of Charge
        value_template: '{{ states.sensor.wd70kwf_range_electric.attributes.soc }}'
      car_tire_pressure_rear_left:
        friendly_name: Tire pressure Rear Left
        value_template: '{{ states.binary_sensor.wd70kwf_tire_warning.attributes.tirepressureRearLeft }}'
      car_tire_pressure_rear_right:
        friendly_name: Tire pressure Rear Right
        value_template: '{{ states.binary_sensor.wd70kwf_tire_warning.attributes.tirepressureRearRight }}'
      car_tire_pressure_front_left:
        friendly_name: Tire pressure Front Left
        value_template: '{{ states.binary_sensor.wd70kwf_tire_warning.attributes.tirepressureFrontLeft }}'
      car_tire_pressure_front_right:
        friendly_name: Tire pressure Front Right
        value_template: '{{ states.binary_sensor.wd70kwf_tire_warning.attributes.tirepressureFrontRight }}'
      car_lock_front_right:
        friendly_name: Lock Front Right
        value_template: >-
          {% if is_state_attr('sensor.wd70kwf_lock', 'doorlockstatusfrontright', false)%}
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('sensor.wd70kwf_lock', 'doorlockstatusfrontright', false)%}
            mdi:lock-outline
          {% else %} 
            mdi:lock-open-variant-outline
          {% endif %}

      car_lock_front_left:
        friendly_name: Lock Front Left
        value_template: >-
          {% if is_state_attr('sensor.wd70kwf_lock', 'doorlockstatusfrontleft', false)%}
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('sensor.wd70kwf_lock', 'doorlockstatusfrontleft', false)%}
            mdi:lock-outline
          {% else %} 
            mdi:lock-open-variant-outline
          {% endif %}

      car_lock_rear_right:
        friendly_name: Lock Rear Right
        value_template: >-
          {% if is_state_attr('sensor.wd70kwf_lock', 'doorlockstatusrearright', false)%}
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('sensor.wd70kwf_lock', 'doorlockstatusrearright', false)%}
            mdi:lock-outline
          {% else %} 
            mdi:lock-open-variant-outline
          {% endif %}

      car_lock_rear_left:
        friendly_name: Lock Rear Left
        value_template: >-
          {% if is_state_attr('sensor.wd70kwf_lock', 'doorlockstatusrearleft', false)%}
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('sensor.wd70kwf_lock', 'doorlockstatusrearleft', false)%}
            mdi:lock-outline
          {% else %} 
            mdi:lock-open-variant-outline
          {% endif %}

      car_lock_trunk:
        friendly_name: Lock trunk
        value_template: >-
          {% if is_state_attr('sensor.wd70kwf_lock', 'decklidstatus', false)%} 
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('sensor.wd70kwf_lock', 'decklidstatus', false)%} 
            mdi:lock-outline
          {% else %}
            mdi:lock-open-variant-outline
          {% endif %}

      car_lock_hood:
        friendly_name: Lock hood
        value_template: >-
          {% if is_state_attr('sensor.wd70kwf_lock', 'hoodStateRollup', false)%} 
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('sensor.wd70kwf_lock', 'hoodStateRollup', false)%} 
            mdi:lock-outline
          {% else %}
            mdi:lock-open-variant-outline
          {% endif %}

      car_window_front_left:
        friendly_name: Window Front Left
        value_template: >-
          {% if is_state_attr('binary_sensor.wd70kwf_windows_closed', 'windowstatusfrontleft', '2')%} 
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('binary_sensor.wd70kwf_windows_closed', 'windowstatusfrontleft', '2')%} 
            mdi:window-closed
          {% else %}
            mdi:window-open
          {% endif %}

      car_window_front_right:
        friendly_name: Window Front Right
        value_template: >-
          {% if is_state_attr('binary_sensor.wd70kwf_windows_closed', 'windowstatusfrontright', '2')%} 
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('binary_sensor.wd70kwf_windows_closed', 'windowstatusfrontright', '2')%} 
            mdi:window-closed
          {% else %}
            mdi:window-open
          {% endif %}

      car_window_rear_left:
        friendly_name: Window Rear Left
        value_template: >-
          {% if is_state_attr('binary_sensor.wd70kwf_windows_closed', 'windowstatusrearleft', '2')%} 
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('binary_sensor.wd70kwf_windows_closed', 'windowstatusrearleft', '2')%} 
            mdi:window-closed
          {% else %}
            mdi:window-open
          {% endif %}

      car_window_rear_right:
        friendly_name: Window Rear Right
        value_template: >-
          {% if is_state_attr('binary_sensor.wd70kwf_windows_closed', 'windowstatusrearright', '2')%} 
              Closed
          {% else %}
              Open
          {% endif %}
        icon_template: >
          {% if is_state_attr('binary_sensor.wd70kwf_windows_closed', 'windowstatusrearright', '2')%} 
            mdi:window-closed
          {% else %}
            mdi:window-open
          {% endif %}

Node red flow

[
    {
        "id": "efcc3827.c8f078",
        "type": "tab",
        "label": "Car",
        "disabled": false,
        "info": ""
    },
    {
        "id": "12e228.11de2dd9",
        "type": "api-current-state",
        "z": "efcc3827.c8f078",
        "name": "eqc",
        "server": "c630b835.1ec538",
        "version": 1,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": false,
        "entity_id": "sensor.wd70kwf_range_electric",
        "state_type": "str",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 210,
        "y": 140,
        "wires": [
            [
                "7fe099f1.b30e88",
                "b5511fbc.5c781",
                "17d7c3fb.f63e9c"
            ]
        ]
    },
    {
        "id": "eeae60c8.5e2f",
        "type": "inject",
        "z": "efcc3827.c8f078",
        "name": "5 min",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "300",
        "crontab": "",
        "once": true,
        "onceDelay": "10",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 90,
        "y": 140,
        "wires": [
            [
                "12e228.11de2dd9"
            ]
        ]
    },
    {
        "id": "7fe099f1.b30e88",
        "type": "function",
        "z": "efcc3827.c8f078",
        "name": "SOC",
        "func": "var newMsg = { payload: msg.data.attributes.soc };\nreturn newMsg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 370,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "b5511fbc.5c781",
        "type": "ha-entity",
        "z": "efcc3827.c8f078",
        "name": "Range in m",
        "server": "c630b835.1ec538",
        "version": 1,
        "debugenabled": false,
        "outputs": 1,
        "entityType": "sensor",
        "config": [
            {
                "property": "name",
                "value": "rangeinmiles"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": false,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 390,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "17d7c3fb.f63e9c",
        "type": "function",
        "z": "efcc3827.c8f078",
        "name": "Charging",
        "func": "var newMsg = { payload: msg.data.attributes.chargingactive };\nreturn newMsg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 380,
        "y": 200,
        "wires": [
            [
                "6b2a970e.0ab9e8"
            ]
        ]
    },
    {
        "id": "6b2a970e.0ab9e8",
        "type": "switch",
        "z": "efcc3827.c8f078",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 510,
        "y": 200,
        "wires": [
            [
                "a8dc59c0.e52258"
            ],
            [
                "8eba6e18.5e51f"
            ]
        ]
    },
    {
        "id": "a8dc59c0.e52258",
        "type": "change",
        "z": "efcc3827.c8f078",
        "name": "true = Yes",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Yes",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 640,
        "y": 180,
        "wires": [
            [
                "6fa870a5.4813c"
            ]
        ]
    },
    {
        "id": "8eba6e18.5e51f",
        "type": "change",
        "z": "efcc3827.c8f078",
        "name": "false = No",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "No",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 640,
        "y": 220,
        "wires": [
            [
                "6fa870a5.4813c"
            ]
        ]
    },
    {
        "id": "6fa870a5.4813c",
        "type": "ha-entity",
        "z": "efcc3827.c8f078",
        "name": "Lovelace",
        "server": "c630b835.1ec538",
        "version": 1,
        "debugenabled": false,
        "outputs": 1,
        "entityType": "sensor",
        "config": [
            {
                "property": "name",
                "value": "chargestatus"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": false,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 780,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "c630b835.1ec538",
        "type": "server",
        "name": "Home Assistant",
        "legacy": false,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true
    }
]

lovelace grid card (omit style: | at the end if you don’t have those card enhancements installed) :

type: grid
cards:
  - type: picture-elements
    elements:
      - entity: sensor.car_status_update
        style:
          transform: 'translate(-50%, -50%) scale(0.8, 0.8)'
          color: lightgrey
          left: 15%
          top: 92%
        type: state-label
      - entity: sensor.car_status_message
        style:
          transform: 'translate(-50%, -50%) scale(0.8, 0.8)'
          color: lightgrey
          left: 15%
          top: 96.5%
        type: state-label
      - type: state-icon
        entity: lock.wd70kwf_lock
        tap-action:
          action: toggle
        icon: 'mdi:car-door'
        name: Door locks
        style:
          transform: 'translate(-50%, -50%) scale(1.3, 1.3)'
          color: red
          left: 67%
          top: 60%
      - entity: sensor.chargestatus
        style:
          transform: 'translate(-50%, -50%) scale(0.9, 0.9)'
          color: lightgrey
          left: 57.5%
          top: 18%
        type: state-label
      - entity: sensor.car_soc
        prefix: ''
        suffix: '%'
        style:
          transform: 'translate(-50%, -50%) scale(1.3, 1.3)'
          color: lightgrey
          left: 15%
          top: 17%
        type: state-label
      - entity: sensor.rangeinmiles
        prefix: ' '
        suffix: ' miles'
        style:
          transform: 'translate(-50%, -50%) scale(1.3, 1.3)'
          color: lightgrey
          left: 39%
          top: 17%
        type: state-label
      - entity: binary_sensor.wd70kwf_tire_warning
        prefix: ''
        style:
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          color: '#FFFFFF'
          left: 66.5%
          top: 17.5%
        type: state-icon
      - entity: binary_sensor.wd70kwf_low_brake_fluid_warning
        prefix: ''
        style:
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          color: '#FFFFFF'
          left: 76%
          top: 17.5%
        type: state-icon
      - entity: binary_sensor.wd70kwf_low_wash_water_warning
        prefix: ''
        style:
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          color: '#FFFFFF'
          left: 95%
          top: 17.5%
        type: state-icon
      - entity: sensor.car_tire_pressure_front_right
        style:
          transform: 'translate(-50%, -50%) scale(0.8, 0.8)'
          color: lightgrey
          left: 38%
          top: 32%
        type: state-label
      - entity: sensor.car_tire_pressure_rear_right
        style:
          transform: 'translate(-50%, -50%) scale(0.8, 0.8)'
          color: lightgrey
          left: 84%
          top: 32%
        type: state-label
      - entity: sensor.car_tire_pressure_front_left
        style:
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          color: lightgrey
          left: 38%
          top: 90%
        type: state-label
      - entity: sensor.car_tire_pressure_rear_left
        style:
          transform: 'translate(-50%, -50%) scale(0.8, 0.8)'
          color: lightgrey
          left: 84%
          top: 90%
        type: state-label
      - entity: sensor.car_lock_front_right
        style:
          '--paper-item-icon-color': white
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 61%
          top: 38%
        type: state-icon
      - entity: sensor.car_lock_rear_right
        style:
          '--paper-item-icon-color': white
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 68%
          top: 38%
        type: state-icon
      - entity: sensor.car_lock_front_left
        style:
          '--paper-item-icon-color': white
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 61%
          top: 83%
        type: state-icon
      - entity: sensor.car_lock_rear_left
        style:
          '--paper-item-icon-color': white
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 68%
          top: 83%
        type: state-icon
      - entity: sensor.car_lock_trunk
        style:
          '--paper-item-icon-color': white
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 95%
          top: 60%
        type: state-icon
      - entity: sensor.car_window_front_right
        style:
          '--paper-item-icon-color': lightgrey
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 56%
          top: 31%
        type: state-icon
      - entity: sensor.car_window_rear_right
        style:
          '--paper-item-icon-color': lightgrey
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 73%
          top: 31%
        type: state-icon
      - entity: sensor.car_window_front_left
        style:
          '--paper-item-icon-color': lightgrey
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 56%
          top: 90%
        type: state-icon
      - entity: sensor.car_window_rear_left
        style:
          '--paper-item-icon-color': lightgrey
          transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
          left: 73%
          top: 90%
        type: state-icon
      - entity: binary_sensor.wd70kwf_park_brake_status
        prefix: ''
        style:
          transform: 'translate(-50%, -50%) scale(0.6, 0.6)'
          color: '#FFFFFF'
          left: 11%
          top: 42%
        type: state-icon
      - entity: binary_sensor.wd70kwf_windows_closed
        prefix: ''
        style:
          transform: 'translate(-50%, -50%) scale(0.6, 0.6)'
          color: '#FFFFFF'
          left: 11%
          top: 52%
        type: state-icon
        icon: null
      - entity: sensor.car_lock_status
        prefix: ''
        style:
          color: '#FFFFFF'
          left: 13%
          top: 64%
        type: state-label
      - entity: device_tracker.wd70kwf_device_tracker
        prefix: ''
        style:
          color: lightgrey
          left: 12%
          top: 77%
        type: state-label
    image: /local/mercnew4.png
  - type: picture-elements
    elements:
      - type: service-button
        title: Deactivate
        service: mbapi2020.preheat_stop
        service_data:
          vin: yourvinnumber
        target: {}
        icon: 'hass:radiator-off'
        style:
          top: 80%
          left: 80%
      - type: service-button
        title: Activate
        service: mbapi2020.preheat_start
        service_data:
          vin: yourvinnumber
        target: {}
        icon: 'hass:radiator'
        style:
          top: 20%
          left: 20%
    image: /local/climate.PNG
style: |
  ha-card {
  background-color: var(--primary-background-color);
  border-radius: 10px;
  margin: 15px;
  box-shadow:
    -4px -4px 8px rgba(255, 255, 255, .5), 5px 5px 8px rgba(0, 0, 0, .03);
  }
columns: 1
square: false

Preheat background graphic climate.PNG

mercnew4.png

I think that’s everything :slight_smile:

4 Likes

Update because locking the car from HA yields lock status 1 (internal) not lock status 2 (external)

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

1 Like

Thanks for that @RhinoRich, I iterated on your code and now have the below (why yes, I did hack into the city’s traffic cam network :laughing:)
Also thanks to @ReneNulschDE for a fantastic integration for us MB fans.

A few weird things:

  1. The integration imported two versions of sensor.xxx_car, one of which has an unrecognizable VIN (also not recognized by Carfax’s lookup tool). I’m ignoring it.
  2. My sunroof shows as open but isn’t.
  3. doorlockstatusoverall shows 0 (unlocked) but doorstatusoverall is 1 and doorlockstatusvehicle is 2. Maybe I just don’t understand what all those things mean, but presumably the 0 status at least is because it thinks the sunroof is open.

2 Likes

Looks really cool. I don’t have a sunroof so don’t use that attribute.

From’s Rene’s github page for this component:
“Values: 0: vehicle unlocked 1: vehicle internal locked 2: vehicle external locked 3: vehicle selective unlocked”
You get 0 from the car’s key, the unlock button in the car or from the service call

Yep, I saw those. I tried deleting and reinstalling the integration and the sunroof is still allegedly open. The second sensor.xxx_car is there again as well but this time the xxx refers to my tag number.

I also tried a remote command for the first time and got this:

Car action: DOORSLOCK failed. error_code: RIS_FORBIDDEN_VIN, error_message: VIN does not belong to user

I confirmed that the VIN is correct in the script, and the same PIN is set in the MB app and the integration. Interestingly, I’m in the US and the vehicle was imported with country code EN and locale en-GB, so I changed them to US and en-US, respectively, with no change. Anyone else seeing something like that?

Have you set the pin code in your MB account?

Yes, three times just to make sure

1 Like

Sorry I missed that in your previous post.

Which version of the component are you using? 5.2? I’m also in the US but I chose to stay on 5.0 as there seems to be some lag in API changes for the US vs Europe.

Do any of your services work? It may seem silly but confirm you can actually lock/unlock from the MB app.

Have you enabled debug or reviewed the json files? I too had issues when I first installed the integration. By chance is the current VIN code a variant of your actual VIN? Maybe a couple characters changed? Look closely

My first attempt at install I saw two devices come across with no sensors. One device was correct while the other was a variation of the actual. The prefix was slightly different. I purposely excluded that VIN on reinstall and everything came across. It seems there may be some settings it looks for in the app account. Like your pin and tag number. Review of the debug and json files finally led me to a solution. It’s been working flawlessly ever since.

Hi,

thanks @rmertz3282: A very good summary of what we have seen in the US.

@fmon: Please use the VIN that is shown in the attributes of a working sensor. Please make sure that you use the same notation (normally all in uppercase).

The error “RIS_FORBIDDEN_VIN” indicates that this is not a PIN problem.

BR
Rene

Thanks to you both for responding so quickly. In response…
I’m using 5.2. The MB app works in all respects. I checked the VIN for the relevant entities and it matches exactly, but as I mentioned I have this second device named after my license plate which contains two entities, car and lock; the VIN listed in the attributes in these entities isn’t the same as the actual VIN. However, the sensors associated with both of them give valid values. I’ll dig into the debug info and see what I can figure out and if that doesn’t work I’ll try the trick of reinstalling with the wonky VIN excluded.

One other item possibly of note is that attempting to open the windows or start the engine gives a different response:

Can't open the windows for car <VIN here>. VIN unknown or feature not availabe for this car.

Please check the following:

  1. Goto the options dialog of the component and activate the option “Disable capabilities check”
  2. Rerun the check to open the Windows

May I please know where you obtained the “top view” photo for your car? Thanks.

I think I found it on Instagram or something… here you go @anon78847916

Thank you, if only I could find the one for the w205 C-Class… I even used the Mercedes-Benz API to download the 36 external perspectives and 4 internal perspectives but they don’t include from the top… :frowning:

Ah I remembered this website. How about this:
https://www.netcarshow.com/mercedes-benz/2008-c-class/1024x768/wallpaper_b5.htm