question

q avatar image
q asked

Bug with VRM API

I'm writing a PowerShell module implementing the VRM API.

Until now, I found 2 bugs with the API concerning the formatWithUnit values. One is %d instead of %s because there are enum values with strings. The other one is % which seems inconsistent.

How to report them ?

VRMapi
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
Guy Stewart (Victron Community Manager) avatar image
Guy Stewart (Victron Community Manager) answered ·

Hi @.Q.,

This is the way, I will pass them onto the VRM devs to have a look.

Thanks

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

q avatar image
q answered ·

Here are some details about this bug.

Using the endpoint to retrieve all most recent logged data for a given installation. https://vrmapi.victronenergy.com/v2/installations/{idSite}/diagnostics?count=1000

I receive the following content :

{
    "success": true,
    "records": [
        ...
        {
            "idSite": {idSite},
            "timestamp": 1662904813,
            "Device": "Gateway",
            "instance": 0,
            "idDataAttribute": 216,
            "description": "VRM Log time offset",
            "formatWithUnit": "%s s",
            "dbusServiceType": null,
            "dbusPath": null,
            "code": "TO",
            "bitmask": 0,
            "formattedValue": "1 s",
            "rawValue": 1,
            "id": 23
        },
       ...
        {
            "idSite": {idSite},
            "timestamp": 1662882312,
            "Device": "VE.Bus System",
            "instance": 276,
            "idDataAttribute": 35,
            "description": "Active input",
            "formatWithUnit": "%d",
            "dbusServiceType": "vebus",
            "dbusPath": "/Ac/ActiveIn/ActiveInput",
            "code": "AI",
            "bitmask": 0,
            "formattedValue": "Disconnected",
            "rawValue": 240,
            "dataAttributeEnumValues": [
                {
                    "nameEnum": "AC Input 1",
                    "valueEnum": 0
                },
                {
                    "nameEnum": "AC Input 2",
                    "valueEnum": 1
                },
                {
                    "nameEnum": "Disconnected",
                    "valueEnum": 240
                }
            ],
            "id": 72
        },
        ...
        {
            "idSite": {idSite},
            "timestamp": 1662882312,
            "Device": "System overview",
            "instance": 0,
            "idDataAttribute": 580,
            "description": "GX Error #48 DVCC with incompatible firmware",
            "formatWithUnit": "%",
            "dbusServiceType": "system",
            "dbusPath": "/Dvcc/Alarms/FirmwareInsufficient",
            "code": "Af",
            "bitmask": 0,
            "formattedValue": "No alarm",
            "rawValue": 0,
            "dataAttributeEnumValues": [
                {
                    "nameEnum": "No alarm",
                    "valueEnum": 0
                },
                {
                    "nameEnum": "Warning",
                    "valueEnum": 1
                }
            ],
            "id": 193
        },
        ...
    ],
    "num_records": 198
}

As you can see, the formatWithUnit for the code TO is "%s s" while the value is numeric. So it should be "%d s"

As you can see, the formatWithUnit for the code AI is "%d" while there are enum values with strings. So it should be "%s".

The same for the next one, code Af is "%" while it should be "%s".


Am I wrong ?

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

The API dev has made a change, but not all the changes until they can confirm there isn't going to be some other unintended consequence.


Thanks again for reporting.

0 Likes 0 ·

Hi @.Q. ,

You are not wrong. We changed all the formatting according to your comment.

Thank you for reporting and good luck with your PowerShell module! Will be nice if you can open source it and share it with the Victron Community.


0 Likes 0 ·

Related Resources