Mercedes Me Component

Thanks for implementing preheating, is there a state you can query to an sensor for conditions with working with the services?
Within the app it is shown if preheating is enabled, I’d love to see that in HA too. Thanks

Hi @apfelflo89,

i have added an attribute “precondActive” to range_electric. Can’t start my precond currently, so test was limited. Let me know, if it gets reported correctly for your car.

BR
Rene

Than you!! I have added the API and I now see the 1 Device (my car) but no entities are showing as of yet. I have also tested the services for unlock and lock and those work as well.

Please let me know what info i can provide so we can test this. Thank you again!

could you switch on debug log. see readme. restart, wait 2min and send me the log via private message? thanks for your help

Thank you, Sent!

Hi,

thanks. Looks like that the North-America websocket connection does not send a full update on initial connect. I wait for a full update before I create the sensors. Let me check how I can handle such a scenario.

BR
Rene

I’ll send you a PM with my logs. In the meantime I noticed that I have 4 “assigned vehicles” showing up in the logs when I only have 2. Strange thing is two of the vehicles are actually mine when I compare the vin, while the other two are slight variations. the first 3 characters and the last 7 are correct. Everything else is different. I excluded the two fictitious vins in the options window and now I have entities, although something isnt quite right.

Thank you! Let me know once you have something that I can test with and I will send you more logs. I really appreciate all this!

I have fixed the “None” problem in the sensor names. Normally, I use the licensePlate but this info was not available. Now the fin/vin is used in that case. (Could be that you have to delete these sensors manually…)

Rene,

My battery wasn’t charged, but in the log I saw the integration did a PRECONDSTART, initiating, processing, finished. So it looks like that is working.

Combined with HA I now have a lot more triggers to act on than in the standard car app.

Many thanks!

1 Like

Could you check the latest code again.
New procedure: I wait now between 30-60 seconds for full updates. If no full update was received then sensors get created with data that we have received so far.

I’m running a couple of tests.

First I removed the integration, removing all devices and sensors.

I updated to the latest version and added the integration. It creates only two devices (I have two cars) with no entities. If I check the logs it adds two initial fake vin followed by by two valid vin #.

If I add the two fake vin #'s to the excluded list and restart, 11 entities are created per vehicle with the vin # showing as a prefix to the entity id.

The odometer is throwing an error complaining about the value. I assumed it was coming across as a string so I modified line 69 in sensor.py and it worked.

From:
distance.convert(self._state, LENGTH_KILOMETERS, LENGTH_MILES))

To:
distance.convert(int(self._state), LENGTH_KILOMETERS, LENGTH_MILES))

  File "/config/custom_components/mbapi2020/sensor.py", line 69, in state
    distance.convert(self._state, LENGTH_KILOMETERS, LENGTH_MILES))
  File "/usr/src/homeassistant/homeassistant/util/distance.py", line 60, in convert
    raise TypeError(f"{value} is not of numeric type")
TypeError: 28274 is not of numeric type

1 Like

Rene, du verdienst echt einen Orden für diese Integration!!!

One question: it seems that the attribute precondActive is consistently false, even if I activate the service „ mbapi2020.preheat_start“ and the preheat is running.

This attribute is quite cool to get an reconfirmation if the preheating was activated. Any idea what goes wrong?

1 Like

Danke Jürgen,

Let me check this, but first I have to find a free charging station :frowning: to many e-cars or to less charging stations in my living area.

Thanks for taking the time to test this.

I have pushed two bugfixes into the master branch. Will be part of release v0.1.1

  1. Your “fake” vins are not blocking the sensor creation anymore. The load just takes a little bit longer because I wait 30 seconds for any messages from the server for each.
  2. sensor.py adjusted

@kilters : Point 1 should fix your problem too.

Rene,

Thank you!!

Just one more minor issues/bug. Nothing critical just offering up my observations.

I no longer see a “low battery warning”. I think the new sensor is starterBatteryState?

          "starterBatteryState": {
            "timestamp": "1610892941",
            "int_value": "0",
            "timestamp_in_ms": "1610892941000",
            "service_ids": [
              505
            ]
          },

My starting point.

Rene,

One more observation that could be corrected at time of use by creating a template sensor.

The drivenTimeReset and distanceRest are shown in KILOMETERS.

Interesting to see one as a string and one in numeric format.

Screen Shot 2021-01-17 at 11.09.10 AM

Hi,

i have published a new release v.0.2.0

New Services:

  • Windows_Open
  • Windows_Close
  • Preheat_Start_DepartureTime

New Sensors:

  • Starter Battery State
  Internal Name: starterBatteryState
  
  Values     Description_short     Description_long
  "0"        "green"               "Vehicle ok"
  "1"        "yellow"              "Battery partly charged"
  "2"        "red"                 "Vehicle not available"
  "3"        "serviceDisabled"     "Remote service disabled"
  "4"        "vehicleNotAvalable"  "Vehicle no longer available"],

This is the first sensor that got the value translation as extended attributes. (See value short, value description)
image

Removed Sensor:

  • warninglowbattery

Fixes:

  • Handling when no data is delivered, added timeout
  • Odometer crashes, when HA Unit System is imperial
3 Likes

Nice! :+1:

mmhhh - good catch, the extended attributes are dumb. I do not know what they mean at execution time and therefore a processing is not so easy. Let me think about this. A good task for the next weekend.

Could you check if the average speed is also wrong? Could be that this is km/h. Also rangeliquid could be in km.