alandtse / tesla

Tesla custom integration for Home Assistant. This requires a refresh token be generated by third-party apps to login.
Apache License 2.0
573 stars 99 forks source link

Heater entities for second/third row seats and steering wheel are unavailable #857

Open MasterDevwi opened 6 months ago

MasterDevwi commented 6 months ago

Version of the custom_component

v3.19.8

Configuration

No custom yaml for configuration. The entities are just missing from the integration. I installed the integration from HACS and set it up through the UI.

Describe the bug

I recently noticed that the heated seat entities for the second and third rows, as well as the heated steering wheel selector, have become unavailable. They worked as recently as a few months ago, but at some point they stopped working. Here's a screenshot showing the issue:

image

I read in a few other bugs that sometimes this happens if the integration is started and it can't connect to the vehicle, so I woke up the vehicle and then reloaded the integration. This fixed the heated steering switch, but not the selector for the steering wheel or rear and third-row seats.

I don't see any errors in the log. It just looks like the integration isn't providing these entities anymore. Were they removed?

Debug log

2024-02-14 09:54:17.404 DEBUG (MainThread) [teslajsonpy.controller] Disconnecting controller. 2024-02-14 09:54:17.404 DEBUG (MainThread) [teslajsonpy.connection] Connection closed. 2024-02-14 09:54:17.405 INFO (MainThread) [custom_components.tesla_custom.teslamate] Un-subbing from all MQTT Topics. 2024-02-14 09:54:17.405 INFO (MainThread) [custom_components.tesla_custom.teslamate] Un-subbed from all MQTT Topics. 2024-02-14 09:54:17.405 DEBUG (MainThread) [custom_components.tesla_custom] Unloaded entry for Tesla 2024-02-14 09:54:17.407 DEBUG (MainThread) [teslajsonpy.connection] Connecting with existing access token 2024-02-14 09:54:17.437 DEBUG (MainThread) [teslajsonpy.controller] 552 endpoints loaded 2024-02-14 09:54:17.438 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 2:01:29 2024-02-14 09:54:17.438 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2024-02-14 09:54:17.584 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{"id"::[REDACTED],"user_id":[REDACTED],"vehicle_id"::[REDACTED],"vin":":[REDACTED]","color":null,"access_type":"OWNER","display_name":":[REDACTED]","option_codes":null,"cached_data":":[REDACTED]","granular_access":{"hide_private":false},"tokens":[":[REDACTED]",":[REDACTED]"],"state":"asleep","in_service":false,"id_s":":[REDACTED]","calendar_enabled":true,"api_version":73,"backseat_token":null,"backseat_token_updated_at":null,"ble_autopair_enrolled":false,"command_signing":"allowed","release_notes_supported":true},{"energy_site_id"::[REDACTED],"resource_type":"wall_connector","id":":[REDACTED]","asset_site_id":":[REDACTED]","warp_site_number":":[REDACTED]-01829","go_off_grid_test_banner_enabled":null,"storm_mode_enabled":null,"powerwall_onboarding_settings_set":null,"powerwall_tesla_electric_interested_in":null,"vpp_tour_enabled":null,"sync_grid_alert_enabled":false,"breaker_alert_enabled":false,"components":{"battery":false,"solar":false,"grid":false,"load_meter":false,"market_type":"residential","wall_connectors":[{"device_id":":[REDACTED]","din":":[REDACTED]","is_active":true}]},"features":{}}],"count":2} 2024-02-14 09:54:17.585 DEBUG (MainThread) [teslajsonpy.controller] 33664: Changing car_online from {} to False 2024-02-14 09:54:17.585 DEBUG (MainThread) [teslajsonpy.controller] 33664: Resetting last_parked_timestamp to: 1707933257 shift_state None 2024-02-14 09:54:17.586 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 2:01:29 2024-02-14 09:54:17.587 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/:[REDACTED]/vehicle_data?endpoints=charge_state%3Bclimate_state%3Bdrive_state%3Bgui_settings%3Bvehicle_config%3Bvehicle_state%3Blocation_data {} 2024-02-14 09:54:17.693 DEBUG (MainThread) [teslajsonpy.connection] 408: {"response":null,"error":"vehicle unavailable: vehicle is offline or asleep","error_description":""} 2024-02-14 09:54:17.694 DEBUG (MainThread) [teslajsonpy.controller] Vehicle offline - data unavailable. 2024-02-14 09:54:17.695 INFO (MainThread) [custom_components.tesla_custom.teslamate] Un-subbing from all MQTT Topics. 2024-02-14 09:54:17.695 INFO (MainThread) [custom_components.tesla_custom.teslamate] Un-subbed from all MQTT Topics. 2024-02-14 09:54:17.695 DEBUG (MainThread) [custom_components.tesla_custom] Connected to the Tesla API 2024-02-14 09:54:17.751 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.tesla_custom.climate.TeslaCarClimate'>) implements HVACMode(s): heat_cool, off and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please create a bug report at https://github.com/alandtse/tesla/issues 2024-02-14 09:54:17.814 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update() 2024-02-14 09:54:17.814 DEBUG (MainThread) [teslajsonpy.controller] Get vehicles. Force: False Time: 1 Interval 60 2024-02-14 09:54:17.814 DEBUG (MainThread) [teslajsonpy.controller] 33664: Skipping update with state asleep. Polling: True. Last update: 1707933258 ago. Last parked: 1 ago. Last wake up 1707933258 ago. 2024-02-14 09:54:17.815 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.001 seconds (success: True) 2024-02-14 09:54:18.299 DEBUG (MainThread) [custom_components.tesla_custom.teslamate] Got car ID. VIN::[REDACTED]TeslamateID: None

skipishere commented 6 months ago

Thanks for providing all that info, it looks like you've supplied the logs for your entire home assistant (which is rather noisy).

If you go to https://my.home-assistant.io/redirect/integration/?domain=tesla_custom you should be able to enable debug logs for the integration on its own which hopefully might have some useful info.

fhteagle commented 6 months ago

I am also seeing similar behavior on my HA instance. With car sleeping or awakened, heated seats left, heated seats right show up corrected, but all 3 rear heated seats selectors are greyed out. Clicking on the entity, "This entity is no longer being provided by the tesla_custom integration. If the entity is no longer in use, delete it in settings."

Were these entities removed intentionally, accidentally?

Current versions in use: 2023 Model Y firmware 2024.2.2.1 6d34fdd99bae Home Assistant (docker container) v 2024.1.5 Tesla integration v3.19.8

MasterDevwi commented 6 months ago

Thanks for providing all that info, it looks like you've supplied the logs for your entire home assistant (which is rather noisy).

If you go to https://my.home-assistant.io/redirect/integration/?domain=tesla_custom you should be able to enable debug logs for the integration on its own which hopefully might have some useful info.

Ah, thanks. That makes a lot more sense. I've updated by original post with the correct logs (and redacted PII).

dragorex71 commented 6 months ago

Same problem with the car in every state (sleep, awake, charging or not) Current versions in use: 2023 Model Y firmware 2024.2.2.1 6d34fdd99bae Home Assistant:

pacemaker82 commented 6 months ago

+1 here - all the same, Model Y etc...

davidcom2 commented 6 months ago

Same here. Model Y and 3.

nickt444 commented 6 months ago

I have same issue on a model 3. Core 2024.2.2 Supervisor 2024.01.1 Operating System 11.5 Frontend 20240207.1 Tesla integration 3.19.8

r0man3 commented 6 months ago

Most data can be fetched with:

{{baseurl}}/api/1/vehicles/{{id}}/vehicle_data/?endpoints=charge_state%3Bclimate_state%3Bclosures_state%3Bdrive_state%3Bgui_settings%3Blocation_data%3Bvehicle_config%3Bvehicle_state%3Bvehicle_data_combo

climate_state with

"seat_heater_left": 0, "seat_heater_rear_center": 0, "seat_heater_rear_left": 0, "seat_heater_rear_right": 0, "seat_heater_right": 0,

(or similar)

should be responsible for the seats.

How can that be added to the code?

smarthomeaf commented 5 months ago

+1

Danie71 commented 5 months ago

Hi all,

Is there already a solution for this?

skipishere commented 5 months ago

@Danie71 if there was we'd close this issue

Ar-eh commented 5 months ago

Does reverting to 3.19.7 help for anyone? It didn't seem to solve the issue for me.

RefleCs commented 5 months ago

Also for me the rear seat heaters aren't configurable anymore. 2024.2.7 on a 2023 Tesla Model Y. It was working but suddenly became greyed out on the same version of the integration.

So I can confirm a working version also isn't working anymore.

My kids were complaining they couldn't set their heated seats anymore that's why I checked my neglected hass configuration....

jherby2k commented 5 months ago

Yup, been broken for several versions now. Don't think I can downgrade easily due to switching to the fleet API.

fhteagle commented 4 months ago

Appears to be fixed for me in Tesla integration v3.20.5 when addressing a 2023MY with 2024.2.2 firmware. Entities show up in my dashboard (were previously greyed out), and toggling each seat from off to high and back showed up in the app as expected.

MasterDevwi commented 4 months ago

Darn, still no luck for me on v3.20.5 with my 2023MY running 2024.3.6.

bolderbast commented 4 months ago

Yes seems to work for me as well with integration v3.20.5 and my 2020M3 running 2024.8.7.

NeWoKiKi commented 4 months ago

Hi,

I confirm that it's working again for me with integration 3.20.5 and 2019M3 running 2024.8.7

Many thanks,

jherby2k commented 4 months ago

also now working today. Not sure if it was 3.20.5 or the Tesla update i applied yesterday (2023 MY, 2024.3.10) that fixed it.

jherby2k commented 4 months ago

Actually it is NOT working now. The entities are no longer unavailable, but don't seem to set anything either. Front seats too! Display state but don't control anything.

NeWoKiKi commented 4 months ago

I've just checked to be sure, for me it's working well, status is correct and I can control seats too.

Ar-eh commented 4 months ago

Confirmed working for me too in a 2022 m3p after updating to 3.20.5. Home Assistant version 2024.3.3, Tesla software version 2024.3.10.

Danie71 commented 4 months ago

I can confirm that it is working again. For me the trick was update V3.20.5.

dragorex71 commented 4 months ago

After update Home Assistant to 2024.4 it stops working again.

fhteagle commented 4 months ago

Same for me, entities are now greyed out again in latest docker container build of core...

Core now 2024.4.0 Frontend now 20240403.1 Tesla integration still 3.20.5 Vehicle firmware still 2024.2.2

NeWoKiKi commented 4 months ago

Same thing for me Updating HA to 2024.4 broke rear seat heaters again :)

Core : 2024.4.0 Supervisor : 2024.03.1 Operating System : 12.1 Frontend : 20240403.1 Tesla Integration : 3.20.5 Vehicle Firmware : 2024.8.7

bolderbast commented 4 months ago

I don't think it was the update that broke it. It think it was the restart. I just restarted HA without updating, and rear seats heating is broken again.

Core : 2024.3.3 Frontend : 20240307.0 Tesla Integration : 3.20.5 Vehicle Firmware : 2024.8.7

fhteagle commented 4 months ago

Back and confirmed responsive again in

Core 2024.4.1 and 2024.4.2 (docker container version) Frontend 20240404.1 Tesla Integration 3.20.5 Car firmware 2024.2.2 (2023 MY w/ HW3)

Survives quick, full, and docker-container based restarts.

Broken again in Core 2024.4.3, all other versions the same. Starting to look more like a random number generator as to whether its working or not...

jherby2k commented 4 months ago

OK, had some time to dig deeper into my issues. So since last week the entities are available and they DO show status - just delayed due to polling interval. However, I can't set them to any values without triggering an "unknown error". The error seems to show after a timeout period of a few seconds. I would like to add that i'm using the API proxy. Everything else seems to work okay.

image

here's the log messages:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tesla_custom/select.py:154
integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 8:16:25 AM (1 occurrences)
Last logged: 8:16:25 AM

[140133074242752] Error handling message: Unknown error (unknown_error) <my name> from <docker ip> (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 794, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1713, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 457, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 509, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 539, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 195, in async_handle_select_option
    await self.async_select_option(option)
  File "/config/custom_components/tesla_custom/select.py", line 154, in async_select_option
    await self._car.remote_seat_heater_request(
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 870, in remote_seat_heater_request
    data = await self._send_command(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 775, in _send_command
    raise ex
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 760, in _send_command
    data = await self._controller.api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1367, in api
    response = await self.__post_with_retries(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 325, in iter
    raise retry_exc.reraise()
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 158, in reraise
    raise self.last_attempt.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1390, in __post_with_retries
    return await self.__connection.post(command, method=method, data=data, url=url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/connection.py", line 166, in post
    return await self.__open(url, method=method, headers=self.head, data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/connection.py", line 218, in __open
    raise TeslaException(resp.status_code)
teslajsonpy.exceptions.TeslaException