-
Notifications
You must be signed in to change notification settings - Fork 101
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_custom.api throws an UnknownError #72
Comments
You need to enable teslajsonpy and read those logs to see why it's failing. As this is access to the raw API interface, I won't be spending much time debugging issues since this is really developer level access. I have no idea if the vehicle_id is the same in teslafi. The teslajsonpy logs will show you the right value. |
Oh please make sure you understand |
Thanks, that was definitely part of my problem. it seems like i can get the API calls to work IF the car is already awake. If i send any commands to a sleeping car, they return the UnknownError immediately. And the car doesn't wake up. I tried sending a WAKE_UP specifically and it still doesn't wake. Just the error. Happy to investigate this myself, but what do you mean by "enable teslajsonpy"? What do i need to do to enable this logging? Sorry, still new to HA development and python in general. |
in the debug section of homeassistan's configuration.yaml add |
Thanks. From the debug output it looks like the vehicle_id / id changed since last night. I know this is an "unsupported feature" but i think to make it useful we need a "vehicle ID" sensor entity to plug into this service call. Otherwise it can't be used in automations / scripts. Thanks for all your hard work by the way! This integration is a godsend. |
I'll look at exposing that somewhere, but it shouldn't change so once you find it, it should work indefinitely. This is meant as an advanced feature since HA doesn't allow any real feedback on it other than the debug logs. |
mine definitely rotated since last night. I made some successful API calls just before midnight after you pointed out that vehicle_id vs id thing, and this morning it was failing because the number had changed. |
Could the normal full response be made available as attributes of the location sensor? Or can that already be accessed elsewhere? That would make the vehicle_id available via attribute and we can use anything in the normal response cadence. Especially in templates. As an example use case, I have a cover template setup for opening and closing the windows. I'm using the latitude and longitude attributes of the location tracker in my api call to close the windows.
If turned into an attribute, I think I could extract the current state of the windows from these in the normal response. Might be nice to have everything available. You never know what could be useful for edge cases.
|
I don't know what you're asking about with "normal full response". Service calls in HA cannot return data. |
Please try the dev branch. The online sensor has attributes for vin, id, and vehicle_id. |
Awesome! Works great. service: tesla_custom.api
data:
command: XXXX
parameters:
path_vars:
vehicle_id: "{{ state_attr('binary_sensor.<car_name>_online_sensor', 'id') }}"
foo: bar ... is going to be the standard template for just about every call, right? Would be cool if you could just do something like this instead: service: tesla_custom.api
data:
command: XXXX
car: <car_name>
parameters:
foo: bar ... but for what it is (a dev mode) this is wonderful. Thanks again! |
Right, sorry. In the logs I see this:
It seems to happen at a pretty steady rate. The 200: response json goes on for a while and has a lot of values. Can all of these values be made available as attributes? |
This is intended to be direct access to the underlying api. Adding a translation layer defeats the point of direct access.
Since every attribute get logged in HA at each update, this is not advisable. You're welcome to submit a PR for a sensor that does this if you want but it must be default off and I won't be maintaining it. |
Hi, Therefore I results in an unknown error I guess:
Thats a get command in the logs (charger switch in HASS)
Does his matter in which location the car is? I guess is should not important if its a US car or EU. Firmware is 2021.44.30.2 |
Version of the custom_component
1.2.0
Configuration
or
Describe the bug
Can't seem to get any tesla_custom.api service calls to work.
Both the above examples return an UnknownError immediately. I imagine i'm doing something wrong, but not sure what. I grabbed the vehicle_id from teslafi - it should always be the same, right?
The text was updated successfully, but these errors were encountered: