Not able to use POST commands
kimmilde opened this issue · 8 comments
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.
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 :)
Yes. I'm using edge branch.. I'm using docker. Any ideas when this update will be commited?
@kimmilde, haven't had time to finish it yet.. hopefully during the coming week :)
@tobiasehlert Any chance you could update the edge image? Kinda hanging out for it.
@kimmilde and @DotNetDann, now this should be resolved.
Try the edge
container label and get back to me with a status on this :)
@tobiasehlert Confirmed working with edge.
Thanks
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
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