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

Can't force data update anymore #830

Closed
kimme1024 opened this issue Jan 23, 2024 · 17 comments
Closed

Can't force data update anymore #830

kimme1024 opened this issue Jan 23, 2024 · 17 comments
Labels
car For items that relate to Tesla vehicles duplicate This issue or pull request already exists

Comments

@kimme1024
Copy link

Version of the custom_component

3.19.5

Configuration

/

Describe the bug

I've been using this integration to connect to my Model S and charge it on solar power with the following script: https://github.com/flashg1/TeslaSolarCharger

It's been working fine for a couple of months (with some errors on the script's side) but since this morning I noticed the car not charging. I checked and all data from the integration were available, however I received an unknown error when clicking the force data update-button. As the script heavily relies on this button to be able to work this seems to be the issue at this point.

I checked the logs and there are multiple API errors (see logs). I tried reinstalling the integration, using a new refresh token. I can add the car without any issues but still the force data update-button isn't working.

Any idea's?

Debug log

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:238
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:37:42 (7 occurrences)
Last logged: 10:54:40

[281472024742976]
[281472023124928]
[281472022096704]
[281472031391424]
[281473202839104]
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 132, in _async_press_action
    await self.async_press()
  File "/config/custom_components/tesla_custom/button.py", line 84, in async_press
    await self.update_controller(wake_if_asleep=True, force=True)
  File "/config/custom_components/tesla_custom/base.py", line 82, in update_controller
    await self.coordinator.controller.update(
  File "/usr/local/lib/python3.11/site-packages/teslajsonpy/controller.py", line 734, in update
    cars = await self.get_vehicles()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/teslajsonpy/controller.py", line 300, in get_vehicles
    return (await self.api("VEHICLE_LIST"))["response"]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/teslajsonpy/controller.py", line 1319, in api
    return await self.__post_with_retries_except_unavailable(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tenacity/__init__.py", line 325, in iter
    raise retry_exc.reraise()
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tenacity/__init__.py", line 158, in reraise
    raise self.last_attempt.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/teslajsonpy/controller.py", line 1351, in __post_with_retries_except_unavailable
    return await self.__connection.post(command, method=method, data=data, url=url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/teslajsonpy/connection.py", line 165, in post
    return await self.__open(url, method=method, headers=self.head, data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/teslajsonpy/connection.py", line 216, in __open
    raise TeslaException(resp.status_code)
teslajsonpy.exceptions.TeslaException
Logger: asyncio
Source: components/websocket_api/http.py:151
First occurred: 10:52:35 (4 occurrences)
Last logged: 10:52:35

socket.send() raised exception.
Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.tesla_custom
Source: helpers/update_coordinator.py:332
Integration: Tesla Custom Integration (documentation, issues)
First occurred: 10:35:34 (2 occurrences)
Last logged: 10:46:10

Error fetching tesla_custom data: Error communicating with API:
@skipishere
Copy link
Collaborator

skipishere commented Jan 23, 2024

I was hit with this myself this morning, I think it's safe to say this is #774 ?

@lotharbach
Copy link

No this is not really the same as #774. This is caused by a change in the owner API for an endpoint that the Tesla App is not using anymore. For the fleet API they apparently maintain this endpoint for backwards compatibility.

The list of vehicles is no longer available at api/1/vehicles but part of api/1/products (which is called by the Tesla App). This call also returns energy products etc so some filter needs to be applied to get vehicles only.

@kimme1024
Copy link
Author

No this is not really the same as #774. This is caused by a change in the owner API for an endpoint that the Tesla App is not using anymore. For the fleet API they apparently maintain this endpoint for backwards compatibility.

The list of vehicles is no longer available at api/1/vehicles but part of api/1/products (which is called by the Tesla App). This call also returns energy products etc so some filter needs to be applied to get vehicles only.

Thanks for the info.
Is there a way to fix this myself or do I have to wait for an official update?

@skipishere
Copy link
Collaborator

skipishere commented Jan 23, 2024

Thanks for the info. Is there a way to fix this myself or do I have to wait for an official update?

If you're happy to make a Pull Request to fix it then by all means, otherwise you'll have to wait for someone else to get round to doing it

@skipishere skipishere added the car For items that relate to Tesla vehicles label Jan 23, 2024
@CHempel-esatus
Copy link

If I have followed the codeflow correctly, the changes to the API must be made in the external package teslajsonpy (https://github.com/zabuldon/teslajsonpy/blob/master/teslajsonpy/endpoints.json).

As soon as a new version is available, it must be used in this plugin and a new release must be made.

@kimme1024
Copy link
Author

Thanks for the info. Is there a way to fix this myself or do I have to wait for an official update?

If you're happy to make a Pull Request to fix it then by all means, otherwise you'll have to wait for someone else to get round to doing it

Sadly my coding skills are less than basic. Otherwise I’d be happy to do so. Let’s hope someone will come with a solution. If needed I’ll be available to test!

@craigsbits
Copy link

If the wake up command works this might kick off an update. Or turn sentry on/off.

@JAFC-BandO

This comment has been minimized.

@skipishere
Copy link
Collaborator

Please refrain from posting generic "me too" type comments, if you want to watch for updates, click the subscribe button
image

@craigsbits
Copy link

craigsbits commented Jan 23, 2024

I removed offending step from automation and Steering wheel and seat heater - heat level / auto also prevented script running, issues seems too coincidental. Debug looks similar.

@grillp
Copy link

grillp commented Jan 23, 2024

Yesyerday I was having the same issue too... I then tried the teslajosnpy client to test if there was something wrong with the API and when calling tesla.vehicle_list() I got:

429 Client Error: Too Many Requests for url: https://owner-api.teslamotors.com/api/1/vehicles

I do use the API a lot when checking for charging rates to make sure I control my charging amps to only use what excess solar is available. So lots of calls every couple of minutes.. starts with a 'force data refresh'..
So thought that may be the issue.. too many calls (as the error message show.. rate limited.. something like than).

This morning tried again with and got this error:

412 Client Error: Endpoint is only available on fleetapi. Visit https://developer.tesla.com/docs for more info for url: https://owner-api.teslamotors.com/api/1/vehicles

Not sure what this means, but I guess they may have changed access to some of the API's?
Hope that helps somehow.

@Ivanszky
Copy link

Asleep state also doesn't update since the same date, probably relates to the same issue.

@lovekull76
Copy link

Looks like this problem has been reported at teslajsonpy (where it belongs) as well.
zabuldon/teslajsonpy#448

@vaibhavratnaparkhi
Copy link

vaibhavratnaparkhi commented Jan 24, 2024

Seems like only 'leasing' cars have this issue.

I have one Y (owned) and 3 (leased).

Y works fine but issue with 3

@lovekull76
Copy link

That is not the case. My owned Y is not working :( Maybe don’t draw conclusions from a sample of two cars.

@vaibhavratnaparkhi
Copy link

That is not the case. My owned Y is not working :( Maybe don’t draw conclusions from a sample of two cars.

Please be advised .. I have mentioned 'seems'. No conclusions drawn... Keep the 'tone' appropriate !!

@alandtse
Copy link
Owner

Closing as this is all #774. Please follow that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car For items that relate to Tesla vehicles duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests