Mercedes Me Component

I got this error:
INFO (SyncWorker_15) [custom_components.mercedesmeapi.oauth] start: get_cached_token
INFO (SyncWorker_15) [custom_components.mercedesmeapi] no token; requesting authorization
INFO (SyncWorker_15) [custom_components.mercedesmeapi] no token; authorization failed; check debug log
INFO (MainThread) [homeassistant.setup] Setup of domain mercedesmeapi took 1.7 seconds.
ERROR (MainThread) [homeassistant.setup] Setup failed for mercedesmeapi: Component 'mercedesmeapi' did not return boolean if setup was successful. Disabling component.

What have i missed in the installation?
I put all the files from the mercedesmeapi github folder to a folder with the same name under custom_components. Then i put in the mercedesmeapi: username etc in the configuration.yaml.
Have i forgotten something? :slight_smile:

Man, this rules! Waiting for you to share that Lovelace block! :wink:

Hello,

I also like to have all sensors instead of many attributes. We can always filter them out ourselves in the frontend.

Thank you for your hard, but splendid work!

Hi, please use the mobile app on IOS or Android and login the first time to accept the data privacy rules. After that restart your home assistant and the car should be visible.

Thanks, works perfect now. I just had to log out and login in the app to accept the data privacy rules.

@ReneNulschDE The new component seems to work fine, but I still get this in my logs:

2019-06-06 23:33:33 ERROR (SyncWorker_10) [custom_components.mercedesmeapi.apicontroller] Connection failed with http code 400

Once again, even though I have this error, I see all my complete car. :wink:

Hi, could you share the related lines before the error message? Do you see the location if your car?

Hi @ReneNulschDE

Is the previous version of the component depreciated? Mine stopped working a few reboots today and I should have a chance to update to the later mbapipy version today, but was just wondering?
Thanks for a great integration!

mb

Previous version also stoppped working for me.

New version works fine. But in the previous version I was able to use device tracker even without an active subscription. In the new version this does not seem to work anymore :slight_smile: .

I have just updated to the new version now. Looks great!!!

Got an afternoon of templating I think :slight_smile:

Everything but the unlock/lock seems to work for me. I have re-logged in on the app and accepted the terms and changed my PIN (also set it in the config.

below is the error:

AttributeError: 'NoneType' object has no attribute 'get'

I get this when I hit unlock - any ideas?

Hello,

Here is the log:

2019-06-07 20:09:03 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] get_car_values Odometer for WDDXXXXXXX called
2019-06-07 20:09:03 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] get_car_values Tires for WDDXXXXXXX called
2019-06-07 20:09:03 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] get_car_values Features for WDDXXXXXXX called
2019-06-07 20:09:03 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] get_location for WDDXXXXXXX called
2019-06-07 20:09:03 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] get location for WDDXXXXXXX called
2019-06-07 20:09:03 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] Connect to URL get https://vhs.meapp.secure.mercedes-benz.com/api/v1/vehicles/WDDXXXXXXX/location
2019-06-07 20:09:04 ERROR (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] Connection failed with http code 400
NoneType: None
2019-06-07 20:09:04 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] get_location result: None
2019-06-07 20:09:04 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] get_car_values Binary_Sensors for WDDXXXXX called
2019-06-07 20:09:04 DEBUG (SyncWorker_6) [custom_components.mercedesmeapi.apicontroller] get_car_values Windows for WDDXXXXXX called

I don’t see my car, not in Hass and not in the app, but that’s because I don’t pay for the “Vehicle Tracker” and “Vehicle Locator” service.

Hi markbajaj,

If you enable logging (see Rene’s instructions abobe, or the messages above might contain it already), you probably see message “Connection failed with http code 400”

I have the same issue, but locking works for me, only unlocking does not. So you are not alone :slight_smile:
Most use cases for car locking would include locking direction only (car rental services excluded).
Hmm, now that I think of it: at home, unlocking could be used to simulate keyless entry. Anywhere else it might be difficult to get accurate enough location info to do it with home assistant. If your car has keyless entry by default, then you should not care of this :slight_smile: .

Jarkko

1 Like

Is there any way of setting friendly names to attributes? Having a list of tanklevelpercent, rangeliquid, averageSpeedStart etc isn’t so sexy. :slight_smile:

Hi Konrad,

Attributes can be presented as own sensors with the template sensor. An example of my car below:

sensor:
  - platform: template
    sensors:
      zmp_619_electricconsumptionreset:
        value_template: "{{ states.sensor.zmp_619_range_electric.attributes.electricconsumptionreset }}"
        unit_of_measurement: 'kWh/100km'

sensor.zmp_619_electricconsumptionreset could be further customized with sexy icons and so on :). I am not sure about the syntax, or if the sensor section does not allow them, but customize section allows changing all settings.

2 Likes

Thank you for giving more debug info. This is what I get back when I press unlock:

2019-06-10 13:43:25 ERROR (SyncWorker_18) [custom_components.mercedesmeapi.apicontroller] Connection failed with http code 403 NoneType: None 2019-06-10 13:43:25 DEBUG (SyncWorker_18) [custom_components.mercedesmeapi.apicontroller] None 2019-06-10 13:43:25 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140185406460816] 'NoneType' object has no attribute 'get' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service connection.context(msg)) File "/usr/src/homeassistant/homeassistant/core.py", line 1150, in async_call self._execute_service(handler, service_call)) File "/usr/src/homeassistant/homeassistant/core.py", line 1172, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 194, in handle_service required_features File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 316, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call await getattr(entity, func)(**data) 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/lock.py", line 69, in unlock self._data.unlock(self._vin, "2568") File "/config/custom_components/mercedesmeapi/apicontroller.py", line 295, in unlock return self._execute_car_action(CAR_UNLOCK_URL, car_id, 'car unlock', pin) File "/config/custom_components/mercedesmeapi/apicontroller.py", line 337, in _execute_car_action if result.get("status") == 'PENDING': AttributeError: 'NoneType' object has no attribute 'get'

Hi @marvinjj,

could you please check the following:

  1. Does the LOCK/UNLOCK work in your official mobile app
  2. PULL the latest code from the repo. It has some fixes for PIN handling

@jruoho: Nice finding :wink:

Hi @molano,

could you enable the config option
save_car_details: True
and send me the feat_WD***.json via private message. Then I’ll change the code and check if the feature is available.

Thx
Rene

Hi @plantoschka, @markbajaj

yes, looks like that the old interface was disabled. We had this situation in the past also. It makes sense to check in some days again.

Please do not ask me about “depreciation” :slight_smile: - the MB Dev team is not talking to me anymore…

BR
Rene

1 Like

Hi,

This is really cool stuff - I do not understand why MB would not be fully supporting you. Mobile application is mandatory for them, but it is not enough. At least I want to have reminder if the car is at home, and no charger connected, I want the car heating automated according to my schedule, and so on.

Locking and unlocking works from mobile, very slowly, and not too reliably (polling state takes ages).
Preconditioning works from mobile (during last days I have not been able to start it, but now it works again).

Locking from HA:
Works, I think. I cannot retry as mobile application refuses to unlock now :confused:

Unlocking from HA:
Does not work

2019-06-11 13:12:46 DEBUG (SyncWorker_5) [custom_components.mercedesmeapi.apicontroller] car unlock for WDD2428901J007644 called

2019-06-11 13:12:46 DEBUG (SyncWorker_5) [custom_components.mercedesmeapi.apicontroller] {'Accept-Language': 'fi_FI', 'Authorization': 'Bearer xxxxxxxx-ea1a-4d5b-b797-49ae962bxxxx', 'country_code': 'FI', 'User-Agent': 'MercedesMe/2.13.2+639 (Android 5.1)', 'x-pin': 'xxxx'}

2019-06-11 13:12:46 DEBUG (SyncWorker_5) [custom_components.mercedesmeapi.apicontroller] Connect to URL post https://vhs.meapp.secure.mercedes-benz.com/api/v1/vehicles/WDD2428901J007644/doors/unlock

2019-06-11 13:12:46 ERROR (SyncWorker_5) [custom_components.mercedesmeapi.apicontroller] Connection failed with http code 400

Preconditioning off from HA:
Works

Preconditioning on from HA:
Does not work

2019-06-11 13:03:49 DEBUG (SyncWorker_5) [custom_components.mercedesmeapi.apicontroller] climate_on for WDD2428901J007644 called

2019-06-11 13:03:49 DEBUG (SyncWorker_5) [custom_components.mercedesmeapi.apicontroller] {'Accept-Language': 'fi_FI', 'Authorization': 'Bearer xxxxxxxx-ea1a-4d5b-b797-49ae962bxxxx', 'country_code': 'FI', 'User-Agent': 'MercedesMe/2.13.2+639 (Android 5.1)', 'x-pin': None}

2019-06-11 13:03:49 DEBUG (SyncWorker_5) [custom_components.mercedesmeapi.apicontroller] Connect to URL post https://vhs.meapp.secure.mercedes-benz.com/api/v1/vehicles/WDD2428901J007644/precond/start

2019-06-11 13:03:50 ERROR (SyncWorker_5) [custom_components.mercedesmeapi.apicontroller] Connection failed with http code 415`

I added one debug print to see the request headers too, no other changes to latest GIT version.