robinostlund / homeassistant-volkswagencarnet

Volkswagen Carnet Component for home assistant
GNU General Public License v3.0
304 stars 60 forks source link

[BUG] Climatization in v4.5.3 is not working with eHybrid #577

Closed virtualdj closed 4 months ago

virtualdj commented 4 months ago

Before you post a new issue - you must first check the following (and check the boxes with an "X" below)

Environment

Describe the bug

The Climatization control is missing, even though this is a plug-in car so it can be warmed/cooled with electric power (either from battery or grid). Is the new control supposed to work only on "ID" vehicles at the moment?

Also, trying to turning on Climatisation from battery switch causes an error on the logs (see below).

Traceback/Error logs

2024-02-19 18:40:20.581 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Turning ON climatisation_without_external_power.
2024-02-19 18:40:20.581 ERROR (MainThread) [volkswagencarnet.vw_vehicle] No climatisation support.
2024-02-19 18:40:20.581 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140623523999680] No climatisation support.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/switch.py", line 94, in async_turn_on
await self.instrument.turn_on()
File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_dashboard.py", line 709, in turn_on
await self.vehicle.set_battery_climatisation(True)
File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_vehicle.py", line 353, in set_battery_climatisation
raise Exception("No climatisation support.")
Exception: No climatisation support.
2024-02-19 18:40:24.486 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Turning OFF climatisation_without_external_power.
2024-02-19 18:40:24.486 ERROR (MainThread) [volkswagencarnet.vw_vehicle] No climatisation support.
2024-02-19 18:40:24.486 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140623523999680] No climatisation support.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/switch.py", line 100, in async_turn_off
await self.instrument.turn_off()
File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_dashboard.py", line 713, in turn_off
await self.vehicle.set_battery_climatisation(False)
File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_vehicle.py", line 353, in set_battery_climatisation
raise Exception("No climatisation support.")
Exception: No climatisation support.
virtualdj commented 4 months ago

@stickpin If you need the credentials, I've shared a guest account with @oliverrahner who has them. He already tried that procedure and was working correctly.

stickpin commented 4 months ago

@virtualdj should be fixed with the next version: https://github.com/robinostlund/volkswagencarnet/pull/250 I've checked with the eGolf 2020. If you want me to check with your vehicle, send me the credentials to my mail (stickpins at gmail dot com).

virtualdj commented 4 months ago

If you want me to check with your vehicle, send me the credentials to my mail (stickpins at gmail dot com).

If possible, I would prefer not to share the main credentials. With @oliverrahner about 5 weeks ago we tested the VW co-user feature successfully; he has got that account which is still enabled and available.

Probably he has been busy with other stuff, but the procedure that he described can be used and works.

stickpin commented 4 months ago

@virtualdj Sorry, I don't have time to mess around with it. Let's wait until the new version is released and then you can test it yourself.

virtualdj commented 4 months ago

Let's wait until the new version is released and then you can test it yourself.

@stickpin I don't know if it helps, but I manually edited the manifest.json on the integration installation like this:

"requirements": [
    "pytz",
    "git+https://github.com/robinostlund/volkswagencarnet.git@v4.4.67#volkswagencarnet==4.4.67"
],

After restarting HA, this seemed to download the correct underlying library because the error message is now different when activating the switch:

2024-02-19 21:35:26.042 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Turning ON climatisation_without_external_power.
2024-02-19 21:35:26.042 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140486002236992] 'targetTemperature_C'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/switch.py", line 94, in async_turn_on
    await self.instrument.turn_on()
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_dashboard.py", line 709, in turn_on
    await self.vehicle.set_battery_climatisation(True)
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_vehicle.py", line 347, in set_battery_climatisation
    "targetTemperature": self.climatisation_target_temperature,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_vehicle.py", line 1263, in climatisation_target_temperature
    return float(find_path(self.attrs, f"{Services.CLIMATISATION}.climatisationSettings.value.targetTemperature_C"))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_utilities.py", line 98, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_utilities.py", line 98, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_utilities.py", line 98, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 1 more time]
KeyError: 'targetTemperature_C'
2024-02-19 21:35:31.206 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Turning OFF climatisation_without_external_power.
2024-02-19 21:35:31.206 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140486002236992] 'targetTemperature_C'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/switch.py", line 100, in async_turn_off
    await self.instrument.turn_off()
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_dashboard.py", line 713, in turn_off
    await self.vehicle.set_battery_climatisation(False)
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_vehicle.py", line 347, in set_battery_climatisation
    "targetTemperature": self.climatisation_target_temperature,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_vehicle.py", line 1263, in climatisation_target_temperature
    return float(find_path(self.attrs, f"{Services.CLIMATISATION}.climatisationSettings.value.targetTemperature_C"))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_utilities.py", line 98, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_utilities.py", line 98, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_utilities.py", line 98, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 1 more time]
KeyError: 'targetTemperature_C'

I still don't see any climate control/temperature, too.

stickpin commented 4 months ago

Seems like your vehicle doesn't have a targetTemperature_C parameter.

virtualdj commented 4 months ago

Seems like your vehicle doesn't have a targetTemperature_C parameter.

Mm, quite interesting! I captured the data using the weconnect-cli project on GitHub and I didn't see targetTemperature_C, too, like you said. But I was quite sure that I could set the temperature in the app... or at least I remembered that!

So, when I opened the Volkswagen app, there was the temperature indicator:

VW app temperature indicator

but when I tapped on that, the temperature scroller didn't appear (sorry I didn't took a screenshot, the one below has been taken after the issue). There were only the two switches below without the part crossed in red:

VW app temperature control

So, in the app, I went into Settings and switched on Climatisation with battery and after going back the temperature control was there! 😮

I then re-ran weconnect-cli and surprise... now there's targetTemperature_C 😮😮 . I copied and pasted the differences to prove it:

WinMerge diff between weconnect-cli output before and after setting "climatisation with battery" in the app

So it seems like the VW backend sometimes is "hiding" the parameter, but I don't know why... the VW app was affected too, anway. In fact, the Climate control magically appeared now:

Climate control visible now

stickpin commented 4 months ago

@virtualdj Yes, the VW backend is acting funny sometimes. :) It's not the first time when I see similar glitches. In any case, I think I've covered your edge use case now. https://github.com/robinostlund/volkswagencarnet/pull/250

P.S. @oliverrahner shared credentials to your vehicle with me now, so I have access now in case you find something strange once again. :)

stickpin commented 4 months ago

The version with the fix is available now: https://github.com/robinostlund/homeassistant-volkswagencarnet/releases/tag/v4.5.4