leeyuentuen / polestar_api

Polestar Api - Home Assistant Component
MIT License
112 stars 18 forks source link

Fix additional server error problem #125

Closed olalid closed 3 months ago

olalid commented 3 months ago

An additional problem was found that also affects the internal server error status.

leeyuentuen commented 3 months ago

i think this is wrong. because evdata is normally from v1 api

olalid commented 3 months ago

Well, I do not agree. get_ev_data fetches the data by calling _get_odometer_data and _get_battery_data which uses the V2 URL. Problem is I guess that get_ev_data also potentially calls get_token when the token needs to be refreshed which uses the V1 URL. So I guess this is a too simple way to fix it, although it does help since "almost" every time that get_ev_data is called it calls a V2 API. Question is, is it really necessary to keep separate "call_code" for V1 and V2 API? Could we just consolidate them in to one to get rid of this problem?

leeyuentuen commented 3 months ago

i need to check then. but v1 is only the car data, v2 is de battery and odo data

why separate? we can't get the car data in v2

olalid commented 3 months ago

I meant why separate lastest_call_code. (I.e. not why use both APIs).