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

API seems readonly. Can't set variables. #827

Closed abroeders closed 9 months ago

abroeders commented 9 months ago

Version of the custom_component: 3.19.5

Configuration

Installed Tesla_Custom plugin through HACS. It retrieves all values correctly from the car.

Describe the bug

Write actions such as set charging limit or SoC limit don't work. When setting these values from Lovelace, the value is never sent to the car. When writing from script, I used the following script for testing: ` alias: Charging amps update mode: restart icon: mdi:battery-charging-60 sequence:

In the 'Error executing script details' i read:

` Logger: homeassistant.components.script.charging_amps_update Source: helpers/script.py:476 Integration: Script (documentation, issues) First occurred: 18:36:25 (1 occurrences) Last logged: 18:36:25

Charging amps update: Error executing script. Unexpected error for call_service at pos 1: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ 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 "/config/custom_components/tesla_custom/services.py", line 55, in async_call_tesla_service response = await api(service_call) ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tesla_custom/services.py", line 115, in api response = await controller.api(name=command, path_vars=path_vars, parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/teslajsonpy/controller.py", line 1293, in api return await self.post_with_retries( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 1334, in post_with_retries 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 `

I also tried node-red @gaphi/node-red-contrib-tesla and that gives 'Forbidden' as result for the call 'setChargingAmps'. I heard some stories about a new API that makes the old API obsolete. I don't know if that's the case here.

It seems that for many people this plugin works great, but I also saw on the Home Assistant Community that some user experience this same problem lately.

laurentgillet commented 9 months ago

I have recently installed the plugin (yesterday!) and observe the same issue: while reading the sensors seems working, setting value don't. For example, when I launch defrost (via script or via UI), I got the same issue: Failed to call service climate/set_hvac_mode. unknown error

skipishere commented 9 months ago

See #774