API rest values mapping

hi there.

there is a place in wich i can get value api mappig to get all values in the immage? it is a screenshot of the victron app for an mppt charger

i tried many endpoints but i cannot find the desired values. i got only battery voltage but nor load output power or current nor instant power from solar panels…

generically speaking could be a very good source a table in wich i can find values and related api call.
unfortunately doc is not organized as i wish

Value API Endpoint Description
Instantaneous Power (Pdc) https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed Instantaneous power generated by the system.
Battery Voltage (bv) https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed Current battery voltage readings.
Total Solar Yield https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed Total solar energy produced.

thanks in advance

regards

U.

Update. here are the variable available in stats

Variable Description Value API Requests
Pdc Series of values (DC power) Variable values (e.g., 1730205972000, 59.6) GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
tsT Series of values (temperature) Variable values (e.g., 1730205972000, 37.5) GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
solar_yield Series of values (solar yield) Variable values (e.g., 1730205972000, 59.6) GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
total_solar_yield Single value (total solar yield) 380.7275717778273 GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
ac_loads Single value (AC loads state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
consumption Single value (consumption state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
consumption_input Single value (input consumption state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
consumption_output Single value (output consumption state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
hub_inverter Single value (hub inverter state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
from_to_grid Single value (grid transfer state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
ac_in Single value (AC input state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
ac_out Single value (AC output state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
ac_genset Single value (AC generator state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
bv Series of values (battery voltages) Variable values (e.g., 1730205972000, 13.2) GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
bs Single value (battery state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
dc Single value (DC state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
evp Single value (EVP state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=venus
total_consumption Single value (total consumption) 0 GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
total_genset Single value (total generator state) 0 GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
grid_history_to Single value (grid transfer history) 0 GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
grid_history_from Single value (grid transfer history) 0 GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
iOI1 Single value (I/O 1 state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=live_feed
Pc Single value (power consumption) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=consumption
Bc Single value (Bc state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=consumption
gc Single value (gc state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=consumption
Gc Single value (Gc state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=consumption
Pb Series of values (solar power) Variable values (e.g., 1730206148000, 0.06) GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=solar_yield
GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=kwh
kwh Series of values (consumption in kWh) Variable values (e.g., 1730206148000, 0.06) GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=kwh
gb Single value (generator state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=generator
gc Single value (gc state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=generator
Tga Single value (generator runtime state) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=generator-runtime
solar_yield_forecast Series of values (solar yield forecast) Variable values (e.g., 1730206217000, 44.45) GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=forecast
vrm_consumption_fc Single value (VRM consumption forecast) false GET https://vrmapi.victronenergy.com/v2/installations/<installationID>/stats?type=forecast

@lsgv i ran out of messages seems

I apologize for any confusion; I’ve just edited the post to enhance its clarity.
it was a typo like your “Once you get is sorted”

I used ChatGPT to organize the API requests (curl prompts) and interpret the results in order to create sensor code for Home Assistant. Additionally, it helped me identify and sort the different variables provided in the API response.

I realize that I may need to improve my understanding of MQTT technology, so I plan to study it further.

Currently, my setup includes VenusOS running on a Raspberry Pi Zero W installed in my van, which is connected to an MPPT charger. This allows me to log data and send it to the cloud. VenusOS is connected to the internet via a local Wi-Fi network provided by a USB LTE modem. I could potentially connect Venus to a VPN and utilize either Modbus or MQTT. I’ve experimented with Modbus locally for a short period.

here follow an example of API request and response

curl --request GET \
  --url 'https://vrmapi.victronenergy.com/v2/installations/XXXXXX/stats?type=venus' \
  --header 'Content-Type: application/json' \
  --header 'x-authorization: Token xxxxxxxxx'
  
  
  
{
  "success": true,
  "records": {
    "Pdc": [
      [
        1730205972000,
        59.60095029448269
      ],
      [
        1730209572000,
        36.343699740467486
      ],
      [
        1730213172000,
        7.898400218510152
      ],
      [
        1730216772000,
        0.17290158924804586
      ],
      [
        1730220372000,
        -0.48191678569713836
      ],
      [
        1730223972000,
        -0.39405010081529995
      ],
      [
        1730227572000,
        -0.41556676441034146
      ],
      [
        1730231172000,
        -0.30578339365919494
      ],
      [
        1730234772000,
        -0.43650007394949325
      ],
      [
        1730238372000,
        -0.4360333640307201
      ],
      [
        1730241972000,
        -0.3267167019963283
      ],
      [
        1730245572000,
        -0.28301665526529335
      ],
      [
        1730249172000,
        -0.45676664649843324
      ],
      [
        1730252772000,
        -0.5436333062072466
      ],
      [
        1730256372000,
        -0.3259999796152
      ],
      [
        1730259972000,
        -0.5649666290501633
      ],
      [
        1730263572000,
        -0.390899970279145
      ],
      [
        1730267172000,
        0.2349999788012672
      ],
      [
        1730270772000,
        8.95040004338428
      ],
      [
        1730274372000,
        24.769866814174236
      ],
      [
        1730277972000,
        46.68718345928589
      ],
      [
        1730281572000,
        59.96340027594672
      ],
      [
        1730285172000,
        63.51836813388071
      ],
      [
        1730288772000,
        77.94925160111977
      ]
    ],
    "tsT": [
      [
        1730205972000,
        37.491666666666625,
        36.5,
        38.6
      ],
      [
        1730209572000,
        37.80333333333329,
        37,
        38.6
      ],
      [
        1730213172000,
        38.064999999999955,
        37,
        38.6
      ],
      [
        1730216772000,
        37.311475409836056,
        36.5,
        38.1
      ],
      [
        1730220372000,
        36.16500000000004,
        35.4,
        37.6
      ],
      [
        1730223972000,
        34.81000000000001,
        34.3,
        35.9
      ],
      [
        1730227572000,
        33.675000000000004,
        32.7,
        34.9
      ],
      [
        1730231172000,
        32.61833333333337,
        32.2,
        33.8
      ],
      [
        1730234772000,
        31.894999999999985,
        31.1,
        32.7
      ],
      [
        1730238372000,
        31.256666666666636,
        30.6,
        32.2
      ],
      [
        1730241972000,
        30.724999999999984,
        30,
        31.6
      ],
      [
        1730245572000,
        30.336666666666662,
        29.5,
        31.1
      ],
      [
        1730249172000,
        29.65333333333334,
        28.9,
        30.6
      ],
      [
        1730252772000,
        29.388333333333343,
        28.9,
        30
      ],
      [
        1730256372000,
        29.110000000000024,
        27.9,
        30
      ],
      [
        1730259972000,
        28.956666666666692,
        27.9,
        30
      ],
      [
        1730263572000,
        28.61833333333336,
        27.9,
        29.5
      ],
      [
        1730267172000,
        28.490163934426256,
        27.9,
        28.9
      ],
      [
        1730270772000,
        28.466666666666693,
        27.9,
        28.9
      ],
      [
        1730274372000,
        29.285000000000007,
        28.9,
        30
      ],
      [
        1730277972000,
        30.563333333333297,
        29.5,
        31.6
      ],
      [
        1730281572000,
        32.37333333333336,
        31.1,
        33.8
      ],
      [
        1730285172000,
        34.08833333333333,
        32.7,
        35.4
      ],
      [
        1730288772000,
        35.99666666666667,
        34.9,
        37
      ]
    ],
    "ac_loads": false,
    "consumption": false,
    "consumption_input": false,
    "consumption_output": false,
    "solar_yield": [
      [
        1730205972000,
        59.60095029448269
      ],
      [
        1730209572000,
        36.343699740467486
      ],
      [
        1730213172000,
        7.898400218510152
      ],
      [
        1730216772000,
        0.17290158924804586
      ],
      [
        1730220372000,
        -0.48191678569713836
      ],
      [
        1730223972000,
        -0.39405010081529995
      ],
      [
        1730227572000,
        -0.41556676441034146
      ],
      [
        1730231172000,
        -0.30578339365919494
      ],
      [
        1730234772000,
        -0.43650007394949325
      ],
      [
        1730238372000,
        -0.4360333640307201
      ],
      [
        1730241972000,
        -0.3267167019963283
      ],
      [
        1730245572000,
        -0.28301665526529335
      ],
      [
        1730249172000,
        -0.45676664649843324
      ],
      [
        1730252772000,
        -0.5436333062072466
      ],
      [
        1730256372000,
        -0.3259999796152
      ],
      [
        1730259972000,
        -0.5649666290501633
      ],
      [
        1730263572000,
        -0.390899970279145
      ],
      [
        1730267172000,
        0.2349999788012672
      ],
      [
        1730270772000,
        8.95040004338428
      ],
      [
        1730274372000,
        24.769866814174236
      ],
      [
        1730277972000,
        46.68718345928589
      ],
      [
        1730281572000,
        59.96340027594672
      ],
      [
        1730285172000,
        63.51836813388071
      ],
      [
        1730288772000,
        77.94925160111977
      ]
    ],
    "hub_inverter": false,
    "from_to_grid": false,
    "ac_in": false,
    "ac_out": false,
    "ac_genset": false,
    "total_solar_yield": [
      [
        1730205972000,
        0.05999755859375
      ],
      [
        1730209572000,
        0.029998779296875
      ],
      [
        1730213172000,
        0.009979248046875
      ],
      [
        1730270772000,
        0.010009765625
      ],
      [
        1730274372000,
        0.029998779296875
      ],
      [
        1730277972000,
        0.050018310546875
      ],
      [
        1730281572000,
        0.069976806640625
      ],
      [
        1730285172000,
        0.05999755859375
      ],
      [
        1730288772000,
        0.05999755859375
      ]
    ],
    "bs": false,
    "dc": false,
    "evp": false
  },
  "totals": {
    "Pdc": 380.7275717778273,
    "tsT": 777.1433060109289,
    "ac_loads": 0,
    "consumption": 0,
    "consumption_input": 0,
    "consumption_output": 0,
    "solar_yield": 380.7275717778273,
    "hub_inverter": 0,
    "from_to_grid": 0,
    "ac_in": 0,
    "ac_out": 0,
    "ac_genset": 0,
    "total_solar_yield": 0.379974365234375,
    "bs": false,
    "dc": false,
    "evp": false
  }
}

solution found. it was my mistake.
i had to add the integer number of the solar charger. so now data are received good seems.
i found the intefer oin VRM cloud

so put it in the istance field of the request


now data seems populated

{
  "success": true,
  "records": {
    "data": {
      "81": {
        "code": "ScV",
        "idDataAttribute": "81",
        "secondsAgo": "19",
        "secondsToNextLog": "60",
        "value": "12.93",
        "valueFloat": "12.93",
        "dataType": "float",
        "dbusServiceType": "solarcharger",
        "dbusPath": "/Dc/0/Voltage",
        "instance": 291,
        "valueString": null,
        "valueEnum": null,
        "nameEnum": null,
        "isValid": "1",
        "isKeyIdDataAttribute": "0",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.1F V",
        "dataAttributeName": "Voltage",
        "rawValue": "12.93",
        "formattedValue": "12.9 V",
        "valueFormattedValueOnly": "12.93",
        "valueFormattedWithUnit": "12.9 V",
        "hasOldData": false
      },
      "85": {
        "code": "ScS",
        "idDataAttribute": "85",
        "secondsAgo": "19",
        "secondsToNextLog": "60",
        "value": "Bulk",
        "valueFloat": null,
        "dataType": "enum",
        "dbusServiceType": "solarcharger",
        "dbusPath": "/State",
        "instance": 291,
        "valueString": null,
        "valueEnum": "3",
        "nameEnum": "Bulk",
        "isValid": "1",
        "isKeyIdDataAttribute": "1",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "dataAttributeName": "Charge state",
        "rawValue": "Bulk",
        "formattedValue": "Bulk",
        "valueFormattedValueOnly": "Bulk",
        "valueFormattedWithUnit": "Bulk",
        "hasOldData": false,
        "dataAttributeEnumValues": [
          {
            "nameEnum": "Off",
            "valueEnum": 0
          },
          {
            "nameEnum": "Fault",
            "valueEnum": 2
          },
          {
            "nameEnum": "Bulk",
            "valueEnum": 3
          },
          {
            "nameEnum": "Absorption",
            "valueEnum": 4
          },
          {
            "nameEnum": "Float",
            "valueEnum": 5
          },
          {
            "nameEnum": "Storage",
            "valueEnum": 6
          },
          {
            "nameEnum": "Equalize",
            "valueEnum": 7
          },
          {
            "nameEnum": "Off",
            "valueEnum": 245
          },
          {
            "nameEnum": "Equalize",
            "valueEnum": 247
          },
          {
            "nameEnum": "Ext. Control",
            "valueEnum": 252
          }
        ]
      },
      "94": {
        "code": "YT",
        "idDataAttribute": "94",
        "secondsAgo": "19",
        "secondsToNextLog": "60",
        "value": "0.17",
        "valueFloat": "0.17",
        "dataType": "float",
        "dbusServiceType": "solarcharger",
        "dbusPath": "/History/Daily/0/Yield",
        "instance": 291,
        "valueString": null,
        "valueEnum": null,
        "nameEnum": null,
        "isValid": "1",
        "isKeyIdDataAttribute": "0",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F kWh",
        "dataAttributeName": "Yield today",
        "rawValue": "0.17",
        "formattedValue": "0.17 kWh",
        "valueFormattedValueOnly": "0.17",
        "valueFormattedWithUnit": "0.17 kWh",
        "hasOldData": false
      },
      "96": {
        "code": "YY",
        "idDataAttribute": "96",
        "secondsAgo": "19",
        "secondsToNextLog": "60",
        "value": "0.01",
        "valueFloat": "0.01",
        "dataType": "float",
        "dbusServiceType": "solarcharger",
        "dbusPath": "/History/Daily/1/Yield",
        "instance": 291,
        "valueString": null,
        "valueEnum": null,
        "nameEnum": null,
        "isValid": "1",
        "isKeyIdDataAttribute": "0",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F kWh",
        "dataAttributeName": "Yield yesterday",
        "rawValue": "0.01",
        "formattedValue": "0.01 kWh",
        "valueFormattedValueOnly": "0.01",
        "valueFormattedWithUnit": "0.01 kWh",
        "hasOldData": false
      },
      "107": {
        "code": "ScW",
        "idDataAttribute": "107",
        "secondsAgo": "19",
        "secondsToNextLog": "60",
        "value": "5.172",
        "valueFloat": "5.172",
        "dataType": "float",
        "dbusServiceType": null,
        "dbusPath": null,
        "instance": 291,
        "valueString": null,
        "valueEnum": null,
        "nameEnum": null,
        "isValid": "1",
        "isKeyIdDataAttribute": "0",
        "formatValueOnly": "%.0F",
        "formatWithUnit": "%.0F W",
        "dataAttributeName": "Battery watts",
        "rawValue": "5.172",
        "formattedValue": "5 W",
        "valueFormattedValueOnly": "5",
        "valueFormattedWithUnit": "5 W",
        "hasOldData": false
      },
      "hasOldData": false,
      "secondsAgo": {
        "value": "19",
        "valueFormattedWithUnit": "19s"
      }
    },
    "meta": {
      "81": {
        "code": "ScV",
        "description": "Voltage",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.1F V",
        "axisGroup": "Battery Voltage"
      },
      "83": {
        "code": "ScT",
        "description": "Battery temperature",
        "formatValueOnly": "%.1F",
        "formatWithUnit": "%.1F °C",
        "axisGroup": null
      },
      "85": {
        "code": "ScS",
        "description": "Charge state",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "90": {
        "code": "SRelay",
        "description": "Relay on the charger",
        "formatValueOnly": "%s",
        "formatWithUnit": "%s",
        "axisGroup": null
      },
      "94": {
        "code": "YT",
        "description": "Yield today",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F kWh",
        "axisGroup": null
      },
      "96": {
        "code": "YY",
        "description": "Yield yesterday",
        "formatValueOnly": "%.2F",
        "formatWithUnit": "%.2F kWh",
        "axisGroup": null
      },
      "107": {
        "code": "ScW",
        "description": "Battery watts",
        "formatValueOnly": "%.0F",
        "formatWithUnit": "%.0F W",
        "axisGroup": null
      }
    },
    "attributeOrder": [
      107,
      85,
      83,
      81,
      94,
      96,
      90
    ]
  }
}
Data Attribute Name Code Raw Value Formatted Value Description Interpretation
Voltage ScV 12.93 12.9 V Battery Voltage The voltage of the battery is 12.9 V.
Charge State ScS Bulk Bulk Charge state The charger is in Bulk mode, meaning it is charging at full current.
Yield Today YT 0.17 0.17 kWh Energy Yield Today The energy produced by the system today is 0.17 kWh.
Yield Yesterday YY 0.01 0.01 kWh Energy Yield Yesterday The energy produced by the system yesterday was 0.01 kWh.
Battery Watts ScW 5.172 5 W Battery Watts The power consumed or produced by the battery is 5 W.
Battery Temperature ScT N/A N/A Battery Temperature No data provided for temperature in this response.
Relay on Charger SRelay N/A N/A Relay Status on Charger No data provided for relay status in this response.

victron_extracted_data_updated.csv (145,8 KB)
here is the full value - ID list so you can use it to query api for specific values.
various id has same description so test it before use. you can test it here for example:
https://vrm-api-docs.victronenergy.com/#/operations/installations/idSite/widgets/Graph

REPO OF THE PROJECT

1 Like

Hi there,
I was wondering if you have been able to get all sorted/working and if you had come across any issues?? (Especially related to the raspberry Pi zero w)
Funnily I am planning to do something potentially very similar for our motorhome, run Venus on a low power raspberry pi zero w and have home assistant run on a pi 4 (we are currently in Greece and waiting to get further north in a few months where hardware is easier accessible to order; hence only playing with HA in a VM on laptop for now and without access to my victron devices)
Would be great if you could share your experience with the raspi zero and its setup? Is it powerful enough? Are you using Bluetooth or ve direct cables via usb adapter?
Thanks in advance!

i have a rpi 02w on my camper, with venus os on it. 0 issue for now. it gets data from victron devices via v.e. dirtect cable to this converter (https://www.duppa.net/shop/isolated-4-port-usb-to-ttl-uart-ftdi/?v=1a13105b7e4e). i used up to 6m of ethernet cable as extension to reach various devices allaround and seems to work flawless. then venus upload data on vrm that i download again via api.

no clue all around about bluetooth working for devices interrogation. seems that is just used for little configuration as other devices

i could use my vpn to reach venusos and pull data via modbus but once i made api working i forgot it.

HA is running on a RPI3b+ and seems just fine. i placed it at home so i could reach it via vpn but not consumig too much energy on the camper.

i have also a tuya zigbee ecosystem with various sensors. i collect it also on HA

it is not the prettiest ui but i’m not a deigner unfortunately.

if you have more questions ask without problem, but fast response on this site is not my skill. try to reach me out on themiamail1234@gmail.com