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

Not able to use POST commands #158

Closed
kimmilde opened this issue Mar 11, 2022 · 8 comments · Fixed by #141
Closed

Not able to use POST commands #158

kimmilde opened this issue Mar 11, 2022 · 8 comments · Fixed by #141

Comments

@kimmilde
Copy link

kimmilde commented Mar 11, 2022

I am using Home Assistant to control my heating etc via rest and it was working great at the beginning.

I am now getting a error in TeslamateApi that I cant figure out.

2022/03/11 19:48:31.468497 [info] checkAuthToken - returning true
2022/03/11 19:48:31.469042 [debug] validateAuthToken - header authorization bearer token valid.
2022/03/11 19:48:31.469094 [debug] TeslaMateAPICarsCommandV1 command received: /wake_up
[GIN] 2022/03/11 - 19:48:31 | 500 |    2.210438ms |   192.168.1.150 | POST     "/api/v1/cars/1/wake_up"
2022/03/11 19:48:31.470614 [error] TeslaMateAPICarsCommandV1 error in http request to https://owner-api.teslamotors.com: Post "https://owner-api.teslamotors.com/api/1/vehicles/XXXXXXXXXXXXXX/wake_up": net/http: invalid header field value "Bearer \x01\nAES.GCM.V1\xb8V\xff\xafW\x95\x12\x95\xc1\xb1\xa6.\x15\xa1\xe6|\x84\x11\xf4$\x18\xedg\x98\x96\xdf\xe4l\xe8\xffE\x94嬳\xc7\xf8\x5\x95\xe9\x92\xfd\xb7I\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXx \xddm\xa5Dg\x94`7l\xf1K36\x15'Aj\xac\x17\xb1\xa7\x9aKU\x81\xc3XXXXXXXDZ:\xf1Z\xfb\xd5L\x96Gt]\x12\xb" for key Authorization

I have with purpose removed some charchers in the http request.

@tobiasehlert
Copy link
Owner

Hi @kimmilde,

Are you using the edge branch of TeslaMate? If so, that might be the reason for this error to appear.
With PR teslamate-org/teslamate#2360, the tokens have been encrypted and the support is not yet built into TeslaMateAPI. It will be added with PR #141 :)

@kimmilde
Copy link
Author

Yes. I'm using edge branch.. I'm using docker. Any ideas when this update will be commited?

@tobiasehlert
Copy link
Owner

@kimmilde, haven't had time to finish it yet.. hopefully during the coming week :)

@DotNetDann
Copy link

@tobiasehlert Any chance you could update the edge image? Kinda hanging out for it.

@tobiasehlert tobiasehlert linked a pull request May 8, 2022 that will close this issue
@tobiasehlert
Copy link
Owner

@kimmilde and @DotNetDann, now this should be resolved.
Try the edge container label and get back to me with a status on this :)

@DotNetDann
Copy link

@tobiasehlert Confirmed working with edge.
Thanks

@kimmilde
Copy link
Author

kimmilde commented May 8, 2022

I am getting a error. Am I doing something wrong?


2022/05/08 19:59:09.226176 [info] checkAuthToken - returning true
2022/05/08 19:59:09.226859 [debug] validateAuthToken - header authorization bearer token valid.
2022/05/08 19:59:09.228624 [error] TeslaMateAPICarsCommandV1 can't get ENCRYPTION_KEY.. will fail to perform command.
2022/05/08 19:59:09.229684 [info] TeslaMateAPICarsCommandV1 - (/api/v1/cars/1/wake_up) executed successfully.
[GIN] 2022/05/08 - 19:59:09 | 500 |    6.876946ms |   192.168.1.150 | POST     "/api/v1/cars/1/wake_up"


Edit:

Looked in source code and found a error message to something else, and found out that I had to add 'Encryption_key' to environment variable! Working now

@tobiasehlert
Copy link
Owner

Hi @kimmilde,

Teslamate itself returns an encryption key when starting. You'd need to set that in your environment variables for them to be persistent for both teslamate and teslamateapi. Else it can't decrypt the token when performing commands :-)

Regards,
Tobias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants