evcc icon indicating copy to clipboard operation
evcc copied to clipboard

chore: use json/v2

Open andig opened this issue 1 month ago • 5 comments

andig avatar Nov 01 '25 10:11 andig

@Maschga I was expecting this PR to be a no-up. Could you figure out why the tests break? Maywe we've not providing the JSON expected after all?

andig avatar Nov 02 '25 12:11 andig

The problem is that now GET /api/sessions returns chargeDuration with the unit seconds and previously it had the unit nanoseconds. No idea why this happens.

Maschga avatar Nov 02 '25 15:11 Maschga

No idea why this happens.

Because I've generally changed this to match precondition and others. Could I ask you to open a new PR to export duration in seconds in order to do this consistently everywhere?

andig avatar Nov 02 '25 15:11 andig

I don't quite understand what you mean by export duration in seconds. Have you not yet changed duration from int64 to time.Duration? Should I correct the tests? Or is it something else?

Maschga avatar Nov 02 '25 17:11 Maschga

With this PR- and in future- we will always un/marshal time.Duration in JSON in seconds. Today, it‘s mixed- planner in seconds, sessions in ns. To fix this, we can make it consistent today or with this PR. In both cases, we‘ll need to change the sessions behaviour of the UI wich expects nano-seconds atm.

andig avatar Nov 02 '25 17:11 andig