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
601 stars 99 forks source link

Can't perform any actions, but integration shows correct information #1009

Closed ukmgranger closed 4 months ago

ukmgranger commented 5 months ago

Is there an existing issue for this?

I have read about the Fleet API and understand I may need to use it

Version of the Tesla component

3.24.0

Version of the Tesla car software

Firmware: 2024.20.1 831cee498fc0

Model

Model 3 SR+

Current Behavior

I get an error in HA if I try to open the charge port, or action any of the available options. I get this message: Failed to call service lock/unlock. unknown error

Expected Behavior

If I click open charge port, it should open. If I turn on the climate, it should turn on etc.

Debug logs

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:241
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 20 June 2024 at 11:48:19 (24 occurrences)
Last logged: 11:18:27

[139980046099808] Unexpected exception
[139980097778976] Unexpected exception
[139980075228976] Unexpected exception
[139980794587904] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/lock/__init__.py", line 242, in async_handle_unlock_service
    await self.async_unlock(**self.add_default_code(kwargs))
  File "/config/custom_components/tesla_custom/lock.py", line 68, in async_unlock
    await self._car.charge_port_door_open()
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 848, in charge_port_door_open
    data = await self._send_command("CHARGE_PORT_DOOR_OPEN")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 785, in _send_command
    raise ex
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 770, 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 142, in async_wrapped
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 58, in __call__
    do = await self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 110, in iter
    result = await action(retry_state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 78, in inner
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 410, in exc_check
    raise retry_exc.reraise()
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 183, 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 61, 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

Anything else?

No response

skipishere commented 5 months ago

Are you using the fleet API? If you can only read data and perform no actions then you must use the fleet API

ukmgranger commented 5 months ago

Is there any information on how to do this?

skipishere commented 5 months ago

Best place to start is in the readme, just to be warned it's not nice and straightford https://github.com/alandtse/tesla?tab=readme-ov-file#tesla-fleet-api-proxy

ukmgranger commented 5 months ago

Whoa! This is looking well above my pay grade! Do you think this is going to be made into a simpler system at some point?

InnoGreenTech commented 5 months ago

Hello, I have the same problem and I use Fleet api proxy. I can't perfom any action too since 2 weeks.

Thancks for your help.

skipishere commented 5 months ago

Hello, I have the same problem and I use Fleet api proxy. I can't perfom any action too since 2 weeks.

Thancks for your help.

@InnoGreenTech if you're using the fleet API and have issues, please create a separate issue

skipishere commented 5 months ago

Whoa! This is looking well above my pay grade! Do you think this is going to be made into a simpler system at some point?

Ideally we'd like to make it simpler but the current way Tesla has implemented it (like needing to create a dev account) makes it difficult. Unfortunately at the moment it's a case of free and difficult or paying a subscription (with other providers) and using their infrastructure.

skipishere commented 4 months ago

Closing as the Fleet API needed to be used