Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BreakdownItem uses incorrect type for raw_value #177

Open
DerekStutsman opened this issue May 28, 2024 · 1 comment
Open

BreakdownItem uses incorrect type for raw_value #177

DerekStutsman opened this issue May 28, 2024 · 1 comment

Comments

@DerekStutsman
Copy link

I noticed importing ChargeHistory started failing, and this is the reason why.
These are the numbers I am getting back from the API, note the raw_value of 193549.99999999997.

This causes parsing to fail with "Number 193549.99999999997 is not representable in Swift."

I would recommend changing raw_value to a double rather than an int.

        "total_charged_energy_breakdown": {
            "home": {
                "value": "194",
                "raw_value": 193549.99999999997,
                "after_adornment": " kWh",
                "sub_title": "Home"
            },
            "super_charger": {
                "value": "588",
                "raw_value": 588000,
                "after_adornment": " kWh",
                "sub_title": "Supercharger"
            },
            "other": {
                "value": "46",
                "raw_value": 46302,
                "after_adornment": " kWh",
                "sub_title": "Other"
            },
            "work": {
                "value": "0",
                "after_adornment": " kWh",
                "sub_title": "Work"
            }
        }
@jonasman
Copy link
Owner

jonasman commented Aug 7, 2024

Can you make a PR to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants