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

Can't set charge limit or charge rate - WebSocket Error #972

Open Lauriz7 opened 5 months ago

Lauriz7 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

1.34.0

Version of the Tesla car software

v11.1 (2024.8.9)

Model

Model 3 Highland

Current Behavior

When setting charge rate or charge limit from UI, it results in error.

Expected Behavior

Expected to change charge rate or charge limit.

Debug logs

Logger: homeassistant.components.websocket_api.http.connection
Kilde: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API (dokumentation, problemer)
Første forekomst: 17.28.51 (7 forekomster)
Senest logget: 17.38.11

[140088965102528] Unexpected exception
[140088971309888] Unexpected exception
[140088945369152] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 116, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/config/custom_components/tesla_custom/number.py", line 91, in async_set_native_value
    await self._car.set_charging_amps(value)
  File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 897, in set_charging_amps
    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 1349, in api
    return 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

MrBLJ commented 5 months ago

Same here. I'm using the hhtp proxy. Could this de related to the recent limit in calls we can ake to the API ? No mention of Error 429.

I have two cars, the other can still accept commands. The one that got this error was charged on solar today, so many adjustments to the charging amps were made.

Edit : found 429 in the logs of the proxy. Seems it's related then :

2024-05-27T15:19:29+02:00 [debug] Server returned 429: Too Many Requests: Retry later

paracetamol32 commented 5 months ago

same here

llamafilm commented 5 months ago

@Lauriz7 do you also see 429 errors in the proxy log?

Lauriz7 commented 5 months ago

@Lauriz7 do you also see 429 errors in the proxy log?

No, just the error above.

MrBLJ commented 5 months ago

@Lauriz7 do you also see 429 errors in the proxy log?

No, just the error above.

Are those HA logs, or the addon logs ? Just asking because I have the same error in HA logs, and I had to check the addon logs to see the mention of 429. Those are in separate places, I did not realize that.

dries-driessens commented 5 months ago

+1 I have tried everything I could think off: upgrade to the the latest HA core, upgrade to the latest custom_tesla, but can no longer update the charge limit Let me know if I can assist with the debugging: I can provide debug logs or am willing to test dev versions

Lauriz7 commented 5 months ago

I think it must be because i am not using fleet api...

dries-driessens commented 5 months ago

agreed! Strangely it continued to work pretty long after the announced phase-out. Also not user-friendly that we were not contacted by Tesla about this shutdown. Surely they know we were use the owner API?

skipishere commented 5 months ago

@dries-driessens they are still phasing it out (for example my Model 3 2023 is still working, amazingly) and they have put some info on their website. The original API that was used was never intended for consumer (and was reverse engineered by the community from the phone app) use hence the lack of developer accounts and using the sign in creds rather than a token so there really wasn't a way to contact users to warn them. (agree it's not ideal overall though)

hammie00 commented 5 months ago

Same problem, charge limit and charge rate not adaptable and the same error. Reading status of the Tesla is fine.

Tesla software 2024.14.9 HA and Tesla HAC the latest.

MrBLJ commented 5 months ago

Same problem, charge limit and charge rate not adaptable and the same error. Reading status of the Tesla is fine.

Tesla software 2024.14.9 HA and Tesla HAC the latest.

Are you using the proxy ? If not you should check if this solves your issue.

DriesDriessens commented 5 months ago

@MrBLJ , what do you mean by proxy? Could you elaborate or point me to docs/tutorials on how to set this up? Thanks!

MrBLJ commented 5 months ago

@MrBLJ , what do you mean by proxy? Could you elaborate or point me to docs/tutorials on how to set this up? Thanks!

Sure, you need this for the integration to work now.. Here's a Tutorial

Lauriz7 commented 5 months ago

@MrBLJ , what do you mean by proxy? Could you elaborate or point me to docs/tutorials on how to set this up? Thanks!

Sure, you need this for the integration to work now.. Here's a Tutorial

Is is possible to set this up when DuckDNS is already used for HA remote access instead of Nabu Casa?

MrBLJ commented 5 months ago

@MrBLJ , what do you mean by proxy? Could you elaborate or point me to docs/tutorials on how to set this up? Thanks!

Sure, you need this for the integration to work now.. Here's a Tutorial

Is is possible to set this up when DuckDNS is already used for HA remote access instead of Nabu Casa?

Yes, in that case you need to use you main domain in NGINX. As an example :

domain: "yourmaindomain.duckdns.org"
hsts: max-age=31536000; includeSubDomains
certfile: fullchain.pem
keyfile: privkey.pem
cloudflare: false
customize:
  active: true
  default: nginx_proxy_default*.conf
  servers: nginx_proxy/*.conf
hammie00 commented 5 months ago

Tnx, and how does this work when on Nabu?

MrBLJ commented 5 months ago

Use DuckDNS to get a secondary domain, follow my tutorial linked above and it'll work I'm in the exact same case.

Currently there's no way to use the nabu url for both HA and proxy. Details about that here.

dries-driessens commented 5 months ago

Thanks @MrBLJ ! 🙏 That's a good tutorial.

Unfortunately, I'm running HA in Docker on my NAS so I don't have most of these addons. Only DuckDNS I was able to find. I'm afraid this is a dead end for me...

MrBLJ commented 5 months ago

Check this out. I haven’t tested it.

getget1980 commented 5 months ago

Hello i'm having problems since 2 or 3 days (using fleet API). It seems that Let's Encrypt is the culprit. Can someone confirm ?

aalllop commented 5 months ago

Hello i'm having problems since 2 or 3 days (using fleet API). It seems that Let's Encrypt is the culprit. Can someone confirm ?

Hello, I'm having same problem. I'm using fleet API and I can change nothing on my car, only consult. I have regenerated the token of Tesla HTTP Proxy app and reconfigure Tesla Integration but same problem. Any ideas?

MrBLJ commented 5 months ago

Hello i'm having problems since 2 or 3 days (using fleet API). It seems that Let's Encrypt is the culprit. Can someone confirm ?

Hello, I'm having same problem. I'm using fleet API and I can change nothing on my car, only consult. I have regenerated the token of Tesla HTTP Proxy app and reconfigure Tesla Integration but same problem. Any ideas?

What do you see in the proxy's logs ?

getget1980 commented 5 months ago

In m’y case I have 403 errors

2024-06-11 21:55:35.380 DEBUG (MainThread) [teslajsonpy.connection] post: [https://owner-api.teslamotors.com/a [...] oor_unlock](https://owner-api.teslamotors.com/api/1/vehicles/LRWXXXXXX/command/door_unlock) {} 2024-06-11 21:55:35.453 DEBUG (MainThread) [teslajsonpy.connection] 403: {"response":null,"error":"Tesla Vehicle Command Protocol required, please refer to the documentation here: [https://developer.tesla.com/docs/fl [...] 34;"}](https://developer.tesla.com/docs/fleet-api#2023-10-09-rest-api-vehicle-commands-endpoint-deprecation-warning","error_description":""%7D) 2024-06-11 21:55:35.455 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140402204221520] Unexpected exception

getget1980 commented 5 months ago

Just managed to make it work.

I had to generate a new refresh token in Tesla http Proxy and remove the old TeslaCustom integration, add it again and set it up once again with the new refresh token.

No need to associate the car again.

aalllop commented 5 months ago

Hello i'm having problems since 2 or 3 days (using fleet API). It seems that Let's Encrypt is the culprit. Can someone confirm ?

Hello, I'm having same problem. I'm using fleet API and I can change nothing on my car, only consult. I have regenerated the token of Tesla HTTP Proxy app and reconfigure Tesla Integration but same problem. Any ideas?

What do you see in the proxy's logs ? I see this: 2024-06-12 12:42:25.247 DEBUG (MainThread) [teslajsonpy.controller] 01473: Sending wake request with deadline of: 1718189005 2024-06-12 12:42:25.248 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 6:19:05 2024-06-12 12:42:25.248 DEBUG (MainThread) [teslajsonpy.connection] post: https://c03d64a7-tesla-http-proxy/api/1/vehicles/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/wake_up {} 2024-06-12 12:42:25.326 DEBUG (MainThread) [teslajsonpy.connection] 429: Retry in 47855 seconds

2024-06-12 12:42:25.327 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140244090204608] 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/number/init.py", line 121, in async_set_value await entity.async_set_native_value(native_value) File "/config/custom_components/tesla_custom/number.py", line 91, in async_set_native_value await self._car.set_charging_amps(value) File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 934, in set_charging_amps data = await self._send_command( ^^^^^^^^^^^^^^^^^^^^^^^^^ 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 1366, in api await self.wake_up(car_id=car_id) File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 475, in wake_up result = await self.api( ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1375, in api return await self.post_with_retries_except_unavailable( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 390, in self._add_action_func(lambda rs: rs.outcome.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 1407, in post_with_retries_except_unavailable 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

MrBLJ commented 5 months ago

Hello i'm having problems since 2 or 3 days (using fleet API). It seems that Let's Encrypt is the culprit. Can someone confirm ?

Hello, I'm having same problem. I'm using fleet API and I can change nothing on my car, only consult. I have regenerated the token of Tesla HTTP Proxy app and reconfigure Tesla Integration but same problem. Any ideas?

What do you see in the proxy's logs ? I see this: 2024-06-12 12:42:25.247 DEBUG (MainThread) [teslajsonpy.controller] 01473: Sending wake request with deadline of: 1718189005 2024-06-12 12:42:25.248 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 6:19:05 2024-06-12 12:42:25.248 DEBUG (MainThread) [teslajsonpy.connection] post: https://c03d64a7-tesla-http-proxy/api/1/vehicles/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/wake_up {} 2024-06-12 12:42:25.326 DEBUG (MainThread) [teslajsonpy.connection] 429: Retry in 47855 seconds

2024-06-12 12:42:25.327 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140244090204608] 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/number/init.py", line 121, in async_set_value await entity.async_set_native_value(native_value) File "/config/custom_components/tesla_custom/number.py", line 91, in async_set_native_value await self._car.set_charging_amps(value) File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 934, in set_charging_amps data = await self._send_command( ^^^^^^^^^^^^^^^^^^^^^^^^^ 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 1366, in api await self.wake_up(car_id=car_id) File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 475, in wake_up result = await self.api( ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1375, in api return await self.post_with_retries_except_unavailable( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 390, in self._add_action_func(lambda rs: rs.outcome.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 1407, in post_with_retries_except_unavailable 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

Error 429 means too many requests. Are those the proxy logs ? those look like HA logs to me.

aalllop commented 5 months ago

Yes that were HA logs. The HTTP Proxy logs are these:

2024-06-12T13:27:57+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/xxxxxxxxxxxxxxxxxxxxxxxx/signed_command: {"routable_message":"MgIIAjoSEhABXJldT0D6rR71DxZazmXbmgMQlgEl0D4wP3fI6Z2zm9T1P3JDCkEEhdvOvVlZ0d6rYRhzr97fL7cu2hvrM3GObMvABw0fMv03KjRsResysZMezJ+W0EYhkkDKrrD0N0PMsaXv17bDbg=="} 2024-06-12T13:27:57+02:00 [debug] Server returned 429: Too Many Requests: Retry in 45123 seconds

2024-06-12T13:27:57+02:00 [debug] [960125d03e303f77c8e99db39bd4f53f] Retrying transmission after error: Retry in 45123 seconds

2024-06-12T13:27:57+02:00 [error] Returning error Internal Server Error

Which is the limit ? Is it configurable?

MrBLJ commented 5 months ago

Yes that were HA logs. The HTTP Proxy logs are these:

2024-06-12T13:27:57+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/xxxxxxxxxxxxxxxxxxxxxxxx/signed_command: {"routable_message":"MgIIAjoSEhABXJldT0D6rR71DxZazmXbmgMQlgEl0D4wP3fI6Z2zm9T1P3JDCkEEhdvOvVlZ0d6rYRhzr97fL7cu2hvrM3GObMvABw0fMv03KjRsResysZMezJ+W0EYhkkDKrrD0N0PMsaXv17bDbg=="} 2024-06-12T13:27:57+02:00 [debug] Server returned 429: Too Many Requests: Retry in 45123 seconds

2024-06-12T13:27:57+02:00 [debug] [960125d03e303f77c8e99db39bd4f53f] Retrying transmission after error: Retry in 45123 seconds

2024-06-12T13:27:57+02:00 [error] Returning error Internal Server Error

Which is the limit ? Is it configurable?

50 is the limit. It's not configurable. Once the limit is reached you can no longer send commands for X hours (not sure what X is, I'd say something like 12).

aalllop commented 5 months ago

Yes that were HA logs. The HTTP Proxy logs are these: 2024-06-12T13:27:57+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/xxxxxxxxxxxxxxxxxxxxxxxx/signed_command: {"routable_message":"MgIIAjoSEhABXJldT0D6rR71DxZazmXbmgMQlgEl0D4wP3fI6Z2zm9T1P3JDCkEEhdvOvVlZ0d6rYRhzr97fL7cu2hvrM3GObMvABw0fMv03KjRsResysZMezJ+W0EYhkkDKrrD0N0PMsaXv17bDbg=="} 2024-06-12T13:27:57+02:00 [debug] Server returned 429: Too Many Requests: Retry in 45123 seconds 2024-06-12T13:27:57+02:00 [debug] [960125d03e303f77c8e99db39bd4f53f] Retrying transmission after error: Retry in 45123 seconds 2024-06-12T13:27:57+02:00 [error] Returning error Internal Server Error Which is the limit ? Is it configurable?

50 is the limit. It's not configurable. Once the limit is reached you can no longer send commands for X hours (not sure what X is, I'd say something like 12).

50 at day? I use it that to change de charging amps of tesla charger based on the power consumed on my house. If 50 at day is the limit is a problem for me.

MrBLJ commented 5 months ago

Yes that were HA logs. The HTTP Proxy logs are these: 2024-06-12T13:27:57+02:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/xxxxxxxxxxxxxxxxxxxxxxxx/signed_command: {"routable_message":"MgIIAjoSEhABXJldT0D6rR71DxZazmXbmgMQlgEl0D4wP3fI6Z2zm9T1P3JDCkEEhdvOvVlZ0d6rYRhzr97fL7cu2hvrM3GObMvABw0fMv03KjRsResysZMezJ+W0EYhkkDKrrD0N0PMsaXv17bDbg=="} 2024-06-12T13:27:57+02:00 [debug] Server returned 429: Too Many Requests: Retry in 45123 seconds 2024-06-12T13:27:57+02:00 [debug] [960125d03e303f77c8e99db39bd4f53f] Retrying transmission after error: Retry in 45123 seconds 2024-06-12T13:27:57+02:00 [error] Returning error Internal Server Error Which is the limit ? Is it configurable?

50 is the limit. It's not configurable. Once the limit is reached you can no longer send commands for X hours (not sure what X is, I'd say something like 12).

50 at day? I use it that to change de charging amps of tesla charger based on the power consumed on my house. If 50 at day is the limit is a problem for me.

50 a day, correct. It's a problem for me as well (using excess solar to charge the car). have a look at : https://github.com/iainbullock/tesla_ble_mqtt_docker

aalllop commented 5 months ago

Ok, thanks for the answers. I will take a look.

Lauriz7 commented 5 months ago

@MrBLJ , what do you mean by proxy? Could you elaborate or point me to docs/tutorials on how to set this up? Thanks!

Sure, you need this for the integration to work now.. Here's a Tutorial

Is is possible to set this up when DuckDNS is already used for HA remote access instead of Nabu Casa?

Yes, in that case you need to use you main domain in NGINX. As an example :

domain: "yourmaindomain.duckdns.org"
hsts: max-age=31536000; includeSubDomains
certfile: fullchain.pem
keyfile: privkey.pem
cloudflare: false
customize:
  active: true
  default: nginx_proxy_default*.conf
  servers: nginx_proxy/*.conf

I got stuck on this this ngix, i used my main duckdns domain name, and got this error:

[19:31:36] INFO: Running nginx... nginx: [warn] conflicting server name "xxxx.duckdns.org" on 0.0.0.0:443, ignored

Any idea what i am doing wrong? Do i need to use different port?

i did change my configuration.yaml to this:

http: use_x_forwarded_for: true trusted_proxies:

MrBLJ commented 5 months ago

@MrBLJ , what do you mean by proxy? Could you elaborate or point me to docs/tutorials on how to set this up? Thanks!

Sure, you need this for the integration to work now.. Here's a Tutorial

Is is possible to set this up when DuckDNS is already used for HA remote access instead of Nabu Casa?

Yes, in that case you need to use you main domain in NGINX. As an example :

domain: "yourmaindomain.duckdns.org"
hsts: max-age=31536000; includeSubDomains
certfile: fullchain.pem
keyfile: privkey.pem
cloudflare: false
customize:
  active: true
  default: nginx_proxy_default*.conf
  servers: nginx_proxy/*.conf

I got stuck on this this ngix, i used my main duckdns domain name, and got this error:

[19:31:36] INFO: Running nginx... nginx: [warn] conflicting server name "xxxx.duckdns.org" on 0.0.0.0:443, ignored

Any idea what i am doing wrong? Do i need to use different port?

i did change my configuration.yaml to this:

http: use_x_forwarded_for: true trusted_proxies: - 172.30.33.0/24

Check this out it might help : https://github.com/llamafilm/tesla-http-proxy-addon/wiki/Setup-guide-using-existing-DuckDNS-&-NGINX-Home-Assistant-SSL-proxy

Pay attention to this part :

If you have already run this add-on before this point, you will need to delete these files the easiest way is likely with a SSH terminal add-on with the following commands

Lauriz7 commented 5 months ago

http: use_x_forwarded_for: true trusted_proxies: - 172.30.33.0/24

Thanks for patience. I tried to follow the guide but i fail again.. Whenever i remove http: ssl_certificate: /ssl/fullchain.pem ssl_key: /ssl/privkey.pem

add this line (with correct identation) "http: use_x_forwarded_for: true trusted_proxies: - 172.30.33.0/24", instead in configuration.yaml i cannot access HA at all. I get error : ERR_SSL_PROTOCOL_ERROR Tried cleared cache, wont help.

Soo..

nginx config (here i used dummy url as per guide)

domain: core-xx hsts: max-age=31536000; includeSubDomains certfile: fullchain.pem keyfile: privkey.pem cloudflare: false customize: active: true default: nginx_proxy_default*.conf servers: nginx_proxy/*.conf

nginx logs:

[19:28:12] INFO: Running nginx...

tesla proxy config: client_id: "" client_secret: "" domain: xx.duckdns.org debug: true regenerate_auth: true region: Europe, Middle East, Africa

So i try to proceed without, but obviously tesla http proxy addon does not start:

curl: (22) The requested URL returned error: 404 Warning: Problem (retrying all errors). Will retry in 16 seconds. 10 retries Warning: left. HTTP/1.1 404 Not Found Content-Type: text/plain; charset=utf-8 Referrer-Policy: no-referrer X-Content-Type-Options: nosniff Server: X-Frame-Options: SAMEORIGIN Content-Length: 14 Date: Fri, 14 Jun 2024 17:31:32 GMT

When i tried using the genuine url in ngnix, the tesla http proxy returned an ssl certificate error. I think I am doing everything as per guide, but no luck...