ReneNulschDE / mbapi2020

Custom Component to integrate MercedesME devices into Home-Assistant
Other
142 stars 27 forks source link

AUX heater not working after update #197

Closed Pivens closed 5 months ago

Pivens commented 5 months ago

The AUX heater is not working anymore after the update. And yes, I have an AUX heater and it worked before. My diagnostics output is included.

Details removed after analysis
ReneNulschDE commented 5 months ago

Thx, is the sensor not working or the service or the switch or all of them?

Services is known and fixed.

Pivens commented 5 months ago

It is the switch...the sensor seems fine

ReneNulschDE commented 5 months ago

And is the switch not available or not working? Do you see a HA log entry with something like: setup_services.._get_config_entryid() takes 1 positional argument but 2 were given

I have no access to a car with aux-heat so its hard without test data.

Pivens commented 5 months ago

the switch is not available and herefore cannot be actuated

Pivens commented 5 months ago

fo sake of completeness...when I reinstall the integration, the aux heat switch does not even show up, as it was seemingly removed as not present in the car

ReneNulschDE commented 5 months ago

yeah, the car data shows that you have the auxheat. may I ask you to do the following:

  1. enable in the configure dialog of the component the option "DEBUG ONLY: Enable save server messages to the messages folder"
  2. restart HA
  3. Wait 2 minutes
  4. Disable in the configure dialog of the component the option "DEBUG ONLY: Enable save server messages to the messages folder"
  5. Send me the json files out of the folder /config/custom_components/mbapi2020/messages via email to mbdev.issue197@nulsch.de
iHaveAstream commented 5 months ago

Hi, same here, Auxheat Switch not available anymore after most recent MBAPI update. I'm on HA 2024.1.6 at the moment. Car: S206

Pivens commented 5 months ago

Guess what, I need to reconfigure the integration, but somehow the mail server providing the PIN does not respond. I assume the json I can currently generate is meaningless. I will continue trying a send the json over as soon as I was able to reconfigure the integration

Pivens commented 5 months ago

Got it running and sent the JSON files over to you. Thank you very much for your great work!

ReneNulschDE commented 5 months ago

Thx, I have added a fake AuxHeat to my cars in the mean time. Can you check the HA error log for an error "AttributeError: 'dict' object has no attribute 'AUXHEAT_START'"

Pivens commented 5 months ago

correct:

Error while setting up mbapi2020 platform for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/mbapi2020/switch.py", line 51, in async_setup_entry getattr(car.features, value[5]), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'AUXHEAT_START'

ReneNulschDE commented 5 months ago

OK, this is fixed in the master branch already and will be part of the next release. Thx for your help getting this solved

iHaveAstream commented 5 months ago

OK, this is fixed in the master branch already and will be part of the next release. Thx for your help getting this solved

Awesome @ReneNulschDE! Many thanks. Just out of curiosity, when will the new release be available?

Thx! Stefan

ReneNulschDE commented 5 months ago

depends on what will come to the table today and over the weekend. Mid next week latest.

In case you need the change now, you can download the switch.py and copy it into the mbapi2020 folder under custom_components. Or take a look on the one-liner change here: https://github.com/ReneNulschDE/mbapi2020/commit/23521928dda5a5277be3a16798b2c119889c50a1

iHaveAstream commented 5 months ago

I've downloaded the switch.py from here and have replaced the previous one under /config/custom_components/mbapi2020. After a HA reboot, I get the following log errors:

Logger: homeassistant.setup Source: setup.py:403 First occurred: 12:07:50 (1 occurrences) Last logged: 12:07:50

Unable to prepare setup for platform 'mbapi2020.switch': Platform not found (Exception importing custom_components.mbapi2020.switch).

Logger: homeassistant.loader Source: loader.py:842 First occurred: 12:07:50 (1 occurrences) Last logged: 12:07:50 Unexpected exception importing platform custom_components.mbapi2020.switch

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 842, in get_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 859, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_components/mbapi2020/switch.py", line 1, in

some github page content

B_tZGyXo0x29ajTvFiuRN5SJd2fcEAO59tP1rFYbejOH9iFNxjikqgcQPB_yPT1KGDhSK8PPA"},"/repos/preferences":{"post":"p2sa162JnHRIgVCbPZ2UCcI7vvaZQa3i6utYgzfZttG8r0TK1vxHUm56TMqBOgagtDV-frKtBGPhO9XWCEzcUA"}}},"title":"mbapi2020/custom_components/mbapi2020/switch.py at 23521928dda5a5277be3a16798b2c119889c50a1 · ReneNulschDE/mbapi2020"} ^^^^^ NameError: name 'false' is not defined

ReneNulschDE commented 5 months ago

ok, you downloaded not the switch.py...

here is the direct link https://raw.githubusercontent.com/ReneNulschDE/mbapi2020/master/custom_components/mbapi2020/switch.py

iHaveAstream commented 5 months ago

ok, sorry. have replaced it now, rebooted HA again. the integration is now working again but same as before, means, no AuxHeat Switch entity available.

"This entity is no longer being provided by the mbapi2020 integration. If the entity is no longer in use, delete it in settings."

ReneNulschDE commented 5 months ago

Please check the HA error log and the diagnostic log of the component and share it here.

iHaveAstream commented 5 months ago

surprisingly, there is no error in HA Log at all after reboot. Pls. find the diagnostics file attached. config_entry-mbapi2020-ab9a858cd55ccb55a06148258ca6285c.json

ReneNulschDE commented 5 months ago

The switch is not created because the feature configuration of your car stated that "AUXHEAT_START"/"AUXHEAT_STOP" is not available. So you have the Auxheat sensors but not the switch. In case you feel that this wrong, you can disable the capability check in the options of the component. You can then try the switch. The output is available when you enable the debug log of the component or check the attributs of the "car" sensor. This sensor has the output of service calls available.

In prior versions my feature check was wrong and created the switch even that the car has not the feature available.

iHaveAstream commented 5 months ago

ahh that one... thanks for the hint! actually I had un-checked the "capabilities check" yesterday just for testing and forgot to re-enable it. I've done so now and the aux heat switch is working again (I have an auxheat for sure ;) )

iHaveAstream commented 5 months ago

Hi @ReneNulschDE the switch itself is working again with fixed switch.py, however, my automation and widget to activate or deactivate the auxheat don't work anymore. those are using mbapi2020.auxheat_start and mbapi2020.auxheat_stop services.

related error message (when trigged via automation, but same when using a widget):

2024-02-12 06:45:00.163 ERROR (MainThread) [homeassistant.components.automation.auto_standheizung_morgens_wochentags_automatisch_aktivieren] [Fzg.] Standheizung morgens wochentags aktivieren (6:45 Uhr): Error executing script. Unexpected error for call_service at pos 1: setup_services.._get_config_entryid() takes 1 positional argument but 2 were given Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/mbapi2020/services.py", line 71, in auxheat_start await domain[_get_config_entryid(hass, call.data.get(CONF_VIN))].client.auxheat_start(call.data.get(CONF_VIN)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: setup_services.._get_config_entryid() takes 1 positional argument but 2 were given 2024-02-12 06:45:00.167 ERROR (MainThread) [homeassistant.components.automation.auto_standheizung_morgens_wochentags_automatisch_aktivieren] While executing automation automation.auto_standheizung_morgens_wochentags_automatisch_aktivieren Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 666, in async_trigger return await self.action_script.async_run( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run return await asyncio.shield(run.async_run()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/mbapi2020/services.py", line 71, in auxheat_start await domain[_get_config_entryid(hass, call.data.get(CONF_VIN))].client.auxheat_start(call.data.get(CONF_VIN)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: setup_services.._get_config_entryid() takes 1 positional argument but 2 were given

ReneNulschDE commented 5 months ago

This should be fixed in v0.10.1. Do you have updated already?

iHaveAstream commented 5 months ago

actually not, I just had overwritten the switch.py of v0.10.0 with the fixed one in order to make the auxheat work again. so shall I update to 0.10.1 and then overwrite switch.py from this link again?

ReneNulschDE commented 5 months ago

correct.

iHaveAstream commented 5 months ago

correct.

Works like a charm! Thx

ReneNulschDE commented 5 months ago

I have published a pre release v0.11.0-beta.1.