Closed jaymunro closed 1 year ago
Thanks Alan. I’m new to this and I’d often wondered how to create a PR.
I’ve forked and edited, but have no idea how to test this with tesla_custom using my new fork or by just manually editing the code in HA (teslajsonpy code does not seem to exist in the custom_components folder). Any pointers would be most welcome.
If you install teslajsonpy locally into custom_components it will take precedence over the system copy. You can also modify it in the system location if you can figure out where your system is hosting the library.
If you install teslajsonpy locally into custom_components it will take precedence over the system copy. You can also modify it in the system location if you can figure out where your system is hosting the library.
Thanks for the pointer. I've downloaded the teslajsonpy source into the custom_components directory and updated code there, but it does not seem to be using the code at that location. I'm probably missing something basic.
This is the location I added the source code for confirmation:
This PR has become more urgent as the BATTERY endpoints have stopped functioning but the SITE_CONFIG endpoint is still OK.
$ python3 ./cli.py -e mark@purcell.id.au -z BATTERY_DATA
Traceback (most recent call last):
File "/home/mark/./cli.py", line 221, in <module>
main()
File "/home/mark/./cli.py", line 122, in main
print(product.api(command, **command_data))
File "/usr/local/lib/python3.9/dist-packages/teslapy/__init__.py", line 726, in api
return self.tesla.api(name, pathvars, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/teslapy/__init__.py", line 363, in api
return self.request(endpoint['TYPE'], uri, serialize,
File "/usr/local/lib/python3.9/dist-packages/teslapy/__init__.py", line 155, in request
response.raise_for_status() # Raise HTTPError, if one occurred
File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 410 Client Error: https://powergate.prd.sn.tesla.services:443/api/powerwalls/1152100-14-J--CN321293G4J50D/fullstatus => Gone for url: https://owner-api.teslamotors.com/api/1/powerwalls/STE20220321-00093
If someone can help me get up to speed with getting tesla_custom
to use my local version of teslajsonpy
then I may be able to test and advance this PR.
If someone can help me get up to speed with getting
tesla_custom
to use my local version ofteslajsonpy
then I may be able to test and advance this PR.
You can use the local version by putting teslajsonpy folder under /config instead of /config/custom_components.
Any chance you could share the Teslajson file? Happy to have a play to try and get it working?
If someone can help me get up to speed with getting
tesla_custom
to use my local version ofteslajsonpy
then I may be able to test and advance this PR.You can use the local version by putting teslajsonpy folder under /config instead of /config/custom_components.
Will try this. Thanks.
My branch is here for those that would like to help https://github.com/jaymunro/teslajsonpy
My branch is here for those that would like to help https://github.com/jaymunro/teslajsonpy
The latest is not working for me but I found this which has the latest API and response. It's a little too much for me to handle.
My changes in that repo were back in June and in response to a different api change, much more minor just involving one number variable self._battery_data.get("operation")
which was replaced by self._site_config.get("default_real_mode")
.
@gkwok1 if you give me access to your repo, I’ll add this change (and the associated logging code change as _battery_data log is no longer working).
@gkwok1 appears to have fixed the issue.
https://github.com/alandtse/tesla/issues/724#issuecomment-1751808022
My changes in that repo were back in June and in response to a different api change, much more minor just involving one number variable
self._battery_data.get("operation")
which was replaced byself._site_config.get("default_real_mode")
.@gkwok1 if you give me access to your repo, I’ll add this change (and the associated logging code change as _battery_data log is no longer working).
I have already included your change in my PR.
Yes, reviewing it now…
My changes in that repo were back in June and in response to a different api change, much more minor just involving one number variable
self._battery_data.get("operation")
which was replaced byself._site_config.get("default_real_mode")
.
Thanks @jaymunro , this Issue and your PR were the early indicators that the upstream API was changing, unfortunately the implications were not fully understood and once the upstream API was finally changed we had this mad scramble for 24 hours to get back to a working condition. Thanks @gkwok1 for turning something around very quickly which is now working and can be merged back into the HA eco system.
The joy of working with an undocumented API :-)
Yes, a pity I didn’t have the knowledge to put the teslajsonpy repo in the right place for testing. Still, scrambles like this are good for keeping the community tight. 😜
Closing as resolved by https://github.com/alandtse/tesla/issues/724#
In HA the operation mode is no longer populated on startup and is left empty. See comment in #618 of https://github.com/alandtse/tesla/issues/618#issuecomment-1590420509
It seems this can be resolved by retrieving the data from the SITE_CONFIG endpoint under the
default_real_mode
property.Details of my API responses are at https://github.com/zabuldon/teslajsonpy/issues/342#issuecomment-1590487294
energy.py, line 175-178:
Change to: