Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBAPI2020 is not working as before #126

Closed
WolfMu opened this issue Apr 5, 2023 · 11 comments
Closed

MBAPI2020 is not working as before #126

WolfMu opened this issue Apr 5, 2023 · 11 comments

Comments

@WolfMu
Copy link

WolfMu commented Apr 5, 2023

First I want to say thank you for integration for Mercedes cars.

Since a couple days the integration shows an error. I already deleted the token and restarted homeassistant, but the problem still is the same after deleting and adding the integration. The 6-digit PIN is send from Mercedes and added to the integration wizard successfully. Maybe the following error message is helpful, or did I oversee any thing? Thx for your help!

2023-04-05 23:48:42.666 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry mbapi2020 for mbapi2020
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/mbapi2020/init.py", line 80, in async_setup_entry
await mercedes.client.set_rlock_mode()
File "/config/custom_components/mbapi2020/client.py", line 923, in set_rlock_mode
info = await system_info.async_get_system_info(self._hass)
File "/usr/src/homeassistant/homeassistant/helpers/system_info.py", line 57, in async_get_system_info
info_object["supervisor"] = info.get("supervisor")
AttributeError: 'NoneType' object has no attribute 'get'

@ReneNulschDE
Copy link
Owner

Hi, this is an problem with HA-core. What is your system setup? HA finds hassio but can't get the information about hassio.

@WolfMu
Copy link
Author

WolfMu commented Apr 6, 2023

Good morning, thank you for your fast response.

I guess you are right, because somehow at 1 AM (1-2 hours after my opened issue) the problem was solved without anything doing on my side and the integration is working again ;-) Actually I was hoping this issue is automatically solved in the last 1-2 weeks.

I observed over the last month, that the sensor.VIN_charging_power is often "nicht verfügbar" / not available. How can I provide you the dignaose information to you (because there is the VIN included) or other informations that you can take a look into?

I use Raspberry PI 4 8GB with raspberry OS and an supervised installtion in docker container. I know this approach is officially not supported, but it works now for years pretty well.

@ReneNulschDE
Copy link
Owner

ReneNulschDE commented Apr 7, 2023

Hi,

is charging power not available on startup or are the values not updated when you charge the car? Are the values available in the mb-mobile-app at the same time ?

@ReneNulschDE
Copy link
Owner

I have added a workaround for the HA system_info bug.

@WolfMu
Copy link
Author

WolfMu commented Apr 7, 2023

Hi, the charging power is not available on startup of HA and also when I charge the car. The values are available in the mb-moblie-app at the same time. I observed it is not a internet connection problem of the car connectivity. I use the integration for around 2 month, and I observed only 2 times the sensor charging power was shown for maybe 1-2 hours (without any change on my side).

@ReneNulschDE
Copy link
Owner

ReneNulschDE commented Apr 7, 2023

Hi, OK - this is nothing that I can see with my cars or was reported on scale so far. Let us dive deeper if you want. To collect some more data do the following:

  1. Make sure your car is not connected to the charger.
  2. Activate the option "DEBUG ONLY: Enable save server messages to the messages folder" in the "Configure"-dialog of the component (under ha, settings, devices...)
  3. Restart HA
  4. Wait few minutes and connect your to a charger
  5. Check in your mb mobile app that the charging and charging power is reported
  6. Stop charging
  7. Deactivate the option "Debug" (see Point 2)
  8. Download the Diagnostic report (Ha, settings, devices..., click on three dots of the MB component and click on "Download diagnostics", save the file
  9. Compress a all files in the HA-config/custum_components/mbapi2020/messages into a zip
  10. send the file from P8 und P9 to mbdev.issue-126@nulsch.de

then I can take a detailed look.

@ReneNulschDE
Copy link
Owner

Do you want to provide more feedback? Otherwise I'll close this issue.

@WolfMu
Copy link
Author

WolfMu commented May 18, 2023

Sorry for the delay, it took a while to collect this information, because sometimes the value (mb power charging) was displayed and sometimes not (when I had not time to work on it). I send you the requested files and I hope this helps to find out the root cause. Let me know if you need further informations.

@M31Galaxy15287
Copy link

Any news on this topic? I'm experiencing the same issue:
The attribute chargingPower of sensor range_electric is much more unavailable than it is available. For instance: during the past 12 days the car charged 4 times and the attribute was only available once during a 3 hour period when the car wasn't even charging with a value of 0 (as it should).
I noticed there also is a sensor named charging _power, but it isn't mentioned in the integrations documentation. This sensor is as much available as the attribute of range_electric with the difference that it sometimes gets a state of -1. When its value drops under 0, the attribute becomes unavailable. It is very hard to find out what triggers this behaviour because the sensor and attribute are rarely available and only for a short period of time. A restart of HA doesn't change anything. Reconfiguring the integration doesn't solve it either.
The last time it happened was yesterday: the sensor suddenly became available with a state of 0 when the car was connected to a charger. At that time the car was still connected but already fully charged for approximately 2 hours. The sensor dropped to a negative state of -1 when I disconnected the car from the charger. At that time the attribute became unavailable again but the sensor's state remained available at -1 until I restarted HA this morning.
BTW: In the Mercedes Me app the charging power shows perfectly each and every time.

@ReneNulschDE
Copy link
Owner

Yes, this is still open as I can't reproduce this with my account/cars.

Background: For some users (not for me), chargingPower is not delivered by the MBAPI at HA startup. The sensors are created only if a value is present at startup. The attributes are created dynamically whenever the values is delivered via the API.

For next version, I plan to create the sensor for any car (even the car has no options to charge) just to check the behavior.

@ReneNulschDE
Copy link
Owner

Fixed with release v0.9.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants