Closed jkellerer closed 1 year ago
@krauskopf: You had been faster as I thought :). Please check my update.
The /vehicles/state
endpoint doesn't return valid JSON and needs an extra step in parsing.
Splitting vehicles and state into 2 calls may make sense though.
Thanks again @jkellerer for the contribution. I finally took some time to look a little bit deeper into the v4 endpoint but could not find the invalid json, that you mentioned. Tried it with both of my cars (330e, M2) but did not get any invalid or tagged json string. Can you please elaborate a little bit about what you are getting? Thanks!
Maybe it isn't needed, anymore. I got a response that looked like the following, initially when changing the code that causes JSON parse errors:
state={...JSON...} capabilities={...JSON...}
Not sure where it came from and whether it is still needed. Have not yet updated to the latest release since I'm running my patched version.
Will close the PR for now, as it seems this isn't an issue. I can open a separate PR if needed later.
Fix for #30: Returns vehicles data using the supported V4 endpoints.
The structure differs and as far as I could see it doesn't make much sense to map that internally. Most data is similar but not all is the same.
This PR is a breaking change, but the only option to get the car status again (as far as I'm aware).
Example of the structural changes:
(properties.areDoorsLocked ? "SECURED" : "OPEN")