sveinse / zaptec

zaptec charger custom component for home assistant
MIT License
11 stars 2 forks source link

Authorization not working #2

Closed vesdakon closed 1 year ago

vesdakon commented 1 year ago

Yesterday I downloaded this zaptec plugin and tested it in my home assistant 2023.4.6 and when I press authorize charging I get this message. No sensors get any value

[547102173280] post request to https://api.zaptec.com/api/chargers/xxxxxxxxxxxxxxx/authorizecharge failed with status 500: <ClientResponse(https://api.zaptec.com/api/chargers/xxxxxxxxxxxxxxx/authorizecharge) [500 Internal Server Error]> <CIMultiDictProxy('Date': 'Wed, 16 Aug 2023 10:48:18 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0', 'Expires': 'Mon, 14 Aug 2023 13:50:39 GMT', 'Vary': 'Origin', 'Request-Context': 'appId=cid-v1:yyyyyyyyyyyyyy', 'X-Rate-Limit-Limit': '30m', 'X-Rate-Limit-Remaining': '29997', 'X-Rate-Limit-Reset': '2023-08-16T11:00:00.0000000Z', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains')>

My zaptec portal have the following settings image (Lokal autentisering, but not auktorisering krävs)

I haven't found any reference to the 500 code. I would really like to have it working together with my other stuff. Am I missing some configuration? Thanks!

sveinse commented 1 year ago

I've seen the same thing on certain Zaptec API commands. For some reason it seems the API gives error 500 internal server error when there is something wrong. I'll have to look into this.

It shouldn't be necessary to use authorize when "authorization required" ("auktorisering krävs") is disabled. In these cases, a plain "Resume charge" is sufficient.

PS! I have released a new version today that you can update and give a go. Thanks.

sveinse commented 1 year ago

Confirming the issue. I'm working on a fix and will publish a fix soon.

sveinse commented 1 year ago

Please retest the newest version @vesdakon

There is a bug in the Zaptec API, where it returns code 500 on "Deauthorize". This is an error from the API, and despite the error, the command is set into action. With other words, its safe to ignore the error for now. I've posted a bug report to Zaptec about it.