question

matthew-hodder avatar image
matthew-hodder asked

API getting blank data values

So I'm not sure what I am doing wrong here, but I'm starting to mess with the VRM API. I am able to generate tokens and anything under 'Installations' I can retrieve data from fine. However anything under General, State or Summary Widgets are all blank data fields.

Using the API Doco website, if I run Battery Summary Data request, using a valid site ID and token, I get a successful request, but the data is blank - below is what I receive - am I missing something obvious?


{
  "success": true,
  "records": {
    "data": {
      "hasOldData": false,
      "secondsAgo": {
        "value": 0,
        "valueFormattedWithUnit": "0s"
      }
    },
    "meta": {
      "47": {
        "code": "V",
        "description": "Voltage",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F V",
        "axisGroup": "Battery Voltage"
      },
      "48": {
        "code": "VS",
        "description": "Starter battery voltage",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F V",
        "axisGroup": null
      },
      "49": {
        "code": "I",
        "description": "Current",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F A",
        "axisGroup": "Battery Current"
      },
      "50": {
        "code": "CE",
        "description": "Consumed Amphours",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F Ah",
        "axisGroup": null
      },
      "51": {
        "code": "SOC",
        "description": "State of charge",
        "formatValueOnly": "%.1F",
        "formatWithUnit": "%.1F %%",
        "axisGroup": null
      },
      "52": {
        "code": "TTG",
        "description": "Time to go",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F h",
        "axisGroup": null
      },
      "54": {
        "code": "Relay",
        "description": "Relay status",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "115": {
        "code": "BT",
        "description": "Battery temperature",
        "formatValueOnly": "%.0F",
        "formatWithUnit": "%.0F °C",
        "axisGroup": null
      },
      "116": {
        "code": "VM",
        "description": "Mid-point voltage of the battery bank",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F V",
        "axisGroup": "Battery Voltage"
      },
      "117": {
        "code": "VMD",
        "description": "Mid-point deviation of the battery bank",
        "formatValueOnly": "%.1F",
        "formatWithUnit": "%.1F %%",
        "axisGroup": null
      },
      "119": {
        "code": "AL",
        "description": "Low voltage alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "120": {
        "code": "AH",
        "description": "High voltage alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "121": {
        "code": "ALS",
        "description": "Low starter-voltage alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "122": {
        "code": "AHS",
        "description": "High starter-voltage alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "123": {
        "code": "ASoc",
        "description": "Low state-of-charge alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "124": {
        "code": "ALT",
        "description": "Low battery temperature alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "125": {
        "code": "AHT",
        "description": "High battery temperature alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "126": {
        "code": "AM",
        "description": "Mid-voltage alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "155": {
        "code": "ALF",
        "description": "Low fused-voltage alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "156": {
        "code": "AHF",
        "description": "High fused-voltage alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "157": {
        "code": "AFB",
        "description": "Fuse blown alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "158": {
        "code": "AHIT",
        "description": "High internal-temperature alarm",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "173": {
        "code": "mcV",
        "description": "Minimum cell voltage",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F V",
        "axisGroup": null
      },
      "174": {
        "code": "McV",
        "description": "Maximum cell voltage",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F V",
        "axisGroup": null
      },
      "182": {
        "code": "eRelay",
        "description": "IO; external relay",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      }
    },
    "attributeOrder": [
      119,
      120,
      121,
      122,
      123,
      124,
      125,
      126,
      155,
      156,
      157,
      158,
      47,
      49,
      50,
      51,
      52,
      48,
      115,
      116,
      117,
      54,
      182,
      173,
      174
    ]
  }
}
api
2 |3000

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

3 Answers
xtedy avatar image
xtedy answered ·

I have the same problem. Did you find a way to solve it?

2 |3000

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

matthew-hodder avatar image
matthew-hodder answered ·

yeah fixed it - was just misunderstanding of the API documentation and command. When you pass the command, you have to include the 'instance' number for the device you want to retrieve the data for.

If you run the 'devices connected' command off the API website first:

https://vrm-api-docs.victronenergy.com/#/operations/installations/idSite/system-overview

It will spit out all your devices and an 'instance' number against each one, put that in the URL for the specific widget or dataset you want and away you go.

For example, if I had a site ID123456 and a device with instance ID 123, and wanted the battery summary data the URL would look like the following:

url = URI("https://vrmapi.victronenergy.com/v2/installations/123456/widgets/BatterySummary?instance=123")

https://vrm-api-docs.victronenergy.com/#/operations/installations/idSite/widgets/BatterySummary

You can use the API website to test to see what stats you get back, but the Instance number is the key.

2 |3000

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

xtedy avatar image
xtedy answered ·

Thank you very much. That's how it works.

2 |3000

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

Related Resources

Additional resources still need to be added for this topic