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

Trim spaces from values #344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vaionicle
Copy link

@vaionicle vaionicle commented Nov 21, 2024

Adding the ability to trim spaces in values.

I got a json response from an Iot device with almost all numeric values contain spaces before or after the value. I trim the spaces to parse them correctly.

{
    "OVERVIEW": {
        "LOCAL_TIME": "Thu, 21 Nov 2024 22:02:09",
        "AKZ": "                                ",
        "OKZ": "                      ",
        "Import_T1": {
            "value": "    13441.23",
            "unit": "kWh"
        },
        "Import_T2": {
            "value": "        0.00",
            "unit": "kWh"
        },
        "Export_T1": {
            "value": "        0.00",
            "unit": "kWh"
        },
        "Export_T2": {
            "value": "        0.00",
            "unit": "kWh"
        },
        "TODAY_T1": {
            "value": "        7.98",
            "unit": "kWh"
        },
        "TODAY_T2": {
            "value": "        0.00",
            "unit": "kWh"
        },
        "THISMONTH_T1": {
            "value": "      296.04",
            "unit": "kWh"
        },
        "THISMONTH_T2": {
            "value": "        0.00",
            "unit": "kWh"
        },
        "P_L1": {
            "value": "0.39",
            "unit": "kW"
        },
        "P_L2": {
            "value": "0.03",
            "unit": "kW"
        },
        "P_L3": {
            "value": "0.03",
            "unit": "kW"
        },
        "P_SUM": {
            "value": "0.45",
            "unit": "kW"
        },
        "VA_SUM": {
            "value": "0.62",
            "unit": "kVA"
        },
        "VARQ1_SUM": {
            "value": "-0.19",
            "unit": "kvar"
        },
        "PF_SUM": {
            "value": "0.727",
            "unit": "     "
        }
    }
}

@vaionicle vaionicle force-pushed the trim_values branch 7 times, most recently from fec07c8 to 04655fe Compare November 21, 2024 21:42
Signed-off-by: Vasileios Tsaknis <[email protected]>
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

Successfully merging this pull request may close these issues.

1 participant