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

Tesla Powerwall integration needs endpoint updates from teslapy #102086

Closed
mcdhome opened this issue Oct 16, 2023 · 2 comments
Closed

Tesla Powerwall integration needs endpoint updates from teslapy #102086

mcdhome opened this issue Oct 16, 2023 · 2 comments

Comments

@mcdhome
Copy link

mcdhome commented Oct 16, 2023

The problem

The Tesla Powerwall HA plugin is having endpoint issues due to Tesla API changes. The Tesla Gateway: set_operation was failing due to endpoint urls being old. A fix is listed below that worked for me as a temp workaround.

What version of Home Assistant Core has the issue?

2023.10.3

What was the last working version of Home Assistant Core?

2023.10.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tesla Powerwall

Link to integration documentation on our website

https://www.home-assistant.io/integrations/powerwall

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

The Tesla Powerwall HA plugin is having endpoint issues due to Tesla API changes.   The Tesla Gateway: set_operation was failing due to endpoint urls being old.  

I copied the teslapy (not telsajsonpy) from this repo into my main /root/config/ folder as was done here for teslajsonpy by gwok1 for Telsa Custom integration, and the set operation mode of my powerwalls is working again.  When this integration is fix/updated, I will be sure to nuke this /root/config/teslapy folder out of the config dir.
https://github.com/tdorssers/TeslaPy/tree/master

It has an updated enpoints.json file.  To be clear, I copied the inner folder teslapy into the /root/config/, didn't copy the whole github repo download, just the inner folder named teslapy.

Additional information

Apologies if I am submitting this wrong.

Here is the original error message that the above fixes:

`Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:468
First occurred: 5:42:31 PM (1 occurrences)
Last logged: 5:42:31 PM

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 404 Client Error: Not Found for url: https://owner-api.teslamotors.com/api/1/powerwalls/STE20210325-00821/operation
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2049, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_gateway/init.py", line 51, in set_operation
await hass.async_add_executor_job(battery.set_operation, service.data['real_mode'])
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/teslapy/init.py", line 662, in set_operation
return self.command('BATTERY_OPERATION_MODE', default_real_mode=mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/teslapy/init.py", line 646, in command
response = self.api(name, **kwargs)['response']
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/teslapy/init.py", line 596, in api
return self.tesla.api(name, pathvars, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/teslapy/init.py", line 286, in api
return self.request(endpoint['TYPE'], uri, serialize,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/teslapy/init.py", line 121, in request
response.raise_for_status() # Raise HTTPError, if one occurred
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://owner-api.teslamotors.com/api/1/powerwalls/STE20210325-00821/operation`

@home-assistant
Copy link

Hey there @bdraco, @jrester, @daniel-simpson, mind taking a look at this issue as it has been labeled with an integration (powerwall) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of powerwall can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign powerwall Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


powerwall documentation
powerwall source
(message by IssueLinks)

@purcell-lab
Copy link
Contributor

There are at least two Tesla integrations available in Home Assistant.

You can have both integrations loaded at the same time, but the issue you highlight here isn't relevant to the core HA integration and could be closed.

@bdraco bdraco closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants