Victron VRM Portal API data integration

Hi. Difficult to say with the data you provide. Have you checked the vrm_data output for the instance carrying the SOC?
But before that, are you using the API because your HA instance is not on the same network/site as the Victron installation, or for another reason? Could you use MQTT or modbus?

I suspect that I inserted incorrect data by copying it. Do I get the sensor data via Postmann or are they standard values?
Yes, I’m not on the same network, otherwise it would be easier.

Hi, my configurations stopped working. I’m running 2024.4.0
No changes have been done to the configuration. Any

I have tested with postman and Token works.
Also tested in Template Editor and i get a ‘value_json’ is undefined


Any idea what could be the problem?

Have you looked into the logs?

Yes, but overlooked the fact that you can’t have more than one "sensor: " in configuration.yaml.
Had to comment out the Nordpool one, now I have to figure out how to use both Nordpool and VRM sensor configured.

sensor: !include sensor.yaml
sensor nordpool:

  • platform: nordpool
    VAT: True

You can have as many sensors as you want, just declare them on separate lines. Or better, if they’re based on templates, put them in a separate template.yml file and include the file. Anyway, glad you found out what the issue was.

Thanks, that’s what I ended up doing.


All good now.

Hi,

I added this to my config and see both Victron and HomeAsstant in the MQTT explorer (and my Javascript WebSocket APP)

mqtt_statestream:
  base_topic: homeassistant
  publish_attributes: false
  publish_timestamps: false 

Is there a possibility to get all the daily kWh data for consumption from solar, battery etc. like in the VRM Portal?

Yes there is. Assuming you have the different power flows (from solar, to and from battery, to loads) you first need to use the “integration” integration to obtain energy flows, and then use the “utility meter” integration to get hourly, daily, weekly etc. total energy produced, stored, consumed.
For a more detailed explanation please look into Victron/Fronius off-grid PV Energy Dashboard - MQTT and modbus integration some off the MQTT part might be too old but in chapters 7, 8 and 9 I give examples of what I believe you are asking.

1 Like

My Power flows are working with the Data i get from the Victron HACS Integration. So i gather all the Data via Modbus. But i do have some Problems to get the correct values for the Energy to use the Utility Meter.

Can you be more clear? You have the power values so you need to use the “integration” integration to transform them into energy. Is there where you run into problems?

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…

for now my exploration got me this

Overview of Available Data from Victron API

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.

Sorry but I don’t really understand your question.
Are you successfully connecting to the API? If so you should see all the topics and not only three of them. Maybe share your Config for this integration.
As I mentioned in other responses I assume you need to use the API integration because your Home Assistant instance is not local to the Victron installation? Is that correct or are both on the same site in which case better to use modbus.

I can connect to the API but i cannot see all the values shared in the app, that i think uses the same api to show data.

I’m interensted in the output load measurement of the mppt in wich there is power from the battery that i want to monitor over night. But i cannot find it in any endpoint that has the load output of the mppt. So the question about.

It is not local because too much power requirement against my long lasting objectives. So i wish to not use modbus. I could create a vpn and collect modbus but if it can be done throught api i would prefere it.

Are you using something like MQTT Explorer to view all the topics exposed? If you want help you need to provide more info.

No, I’m not using the mqtt explorer. I use curl call directly and see results by sight and chatgpt.
I will try mqtt explorer at that point. But it is a local lan option. I wish to contact the API on web and extract info from it.

Wich info do you need?

I had many more values from the API endpoint. The endpoint stats has some specification also like venus, live_feed ecc… i tried anyone but cannot find desired values. Here is the variable table builted with chatgpt but not verified by me. Anyway lots of values semmed not available and, the output load, value of my interest, is not present seems.

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

I don’t understand/know what “ree by sight” is and how chatgpt would be useful here, but then, I don’t know much.
When I used the API I used Postman to get the full output of the call and sifted through the output to find what I needed.
But if you use MQTT to setup and debug it can go faster, I guess, and you have an MQTT broker on the Victron GX device itself (CCGX or Cerbo whichever you are using). You can then use MQTT Explorer, and once you connect it to your MQTT broker you will see what there is to see i.e. all the topics published. Just follow the instructions of section 3 here and let us know what you find out. Once you get is sorted out then you know which topics you need and where to find them.
If you want to share info maybe start with your config and the output of your API call. Hide the token.

Not sure if my video at https://youtu.be/dlvlhou70VA?si=oG_Kt0j17IlWsrhq&t=2654 will help - I was using Modbus to query the registers. But maybe the explanation will also help give some context to getting the values you need.

I apologize for any confusion; I’ve just edited the post to enhance its clarity.
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, I cant understand why could be faster to debug if i’m talking with the VRM cloud, 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
  }
}