Victron VRM Portal API data integration

Have you looked into 2022.12: It does matter! - Home Assistant
The MQTT sensor configuration has changed. Did you catch that and changed your sensor configurations to the new standard?
As a rule, I always read the release notes in full especially the breaking changes part.

Does anybody has an example how to convert the old sensor into the new version?

That was running in the config yaml until update…

sensor:

VICTRON PV SOLAR

  • platform: mqtt
    unique_id: victron_cons_L1
    name: “victron_cons_L1”
    state_topic: ‘N/d41243b5xxxx/system/0/Ac/Consumption/L1/Power’
    unit_of_measurement: “W”
    value_template: “{{ value_json.value | float(0) | round(0) }}”

I’ve tried also this with no result

VICTRON PV SOLAR

mqtt:
sensor:

  • name: “victron_cons_L1”
    unique_id: victron_cons_L1
    state_topic: “N/d41243bxxxxx/system/0/Ac/Consumption/L1/Power”
    unit_of_measurement: “W”
    value_template: “{{ value_json.value | float(0) | round(0) }}”

To share code you need to use the preformated text using the editing sign

</>

that you find at the top of your comment text editing window. That way your exact formatting comes through and you will get better advice. This bring said, your MQTT sensor configuration should look like:

# Example configuration.yaml entry
mqtt:
  sensor:
    - state_topic: "home/bedroom/temperature"

In your case I guess this would be (note the indentations, YAML requires strict indentations to work):

mqtt:
  sensor:
    - name: “victron_cons_L1”
    - unique_id: victron_cons_L1
    - state_topic: “N/d41243bxxxxx/system/0/Ac/Consumption/L1/Power”
    - unit_of_measurement: “W”
    - value_template: “{{ value_json.value | float(0) | round(0) }}”

Give it a try and let me know if it works.

Hallo und guten Tag. Ich entschuldige mich, dass ich auf deutsch schreibe, aber da bin ich sicher, dass ich keine Fehler erkläre.

Ich habe seit 3 Wochen ein Victron System mit 1xMultiplus2, 1xCerbo GX und 2xMPPT Lader.
Ich habe es irgendwie geschafft, dass über mqtt Daten gesendet werden. Aber ich finde keine Tageswerte, wie sie im VRM gezeigt werden.
Nun habe ich gesucht und die Seite “vrm api docs.victronenergy .com/#/” gefunden.
Hier “VRM API documentation” kann ich mit der Email Adresse und dem Passwort einen Token erstellen. Egal wie ich diesen verwende, komme ich nicht weiter.
Ich wollte im nächsten Schritt hier “VRM API documentation” weiter machen.
image
Die Informationen von @lsgv Luis sind hervorragend geschrieben, aber ich habe den nächsten Schritt aus den Texten nicht erlesen können. Was kann ich tun?
Allgemein suche ich eine Möglichkeit, Tageswerte für Solarertrag und Verbrauch zu bekommen.
Danke fürs Lesen.
Guido

Hello Guido. My German is quite limited and rusty but I got the point.

This original post is quite old and dates from the time I did not know better and how to use Victron MQTT broker to establish a local connection rather then using VRM and be dependent on the internet connection.

Do you need to use VRM because your HA instance is not on the same network as your Victron installation? That is really the only case I can think of for using the API. If that is the case, then I’ll try to dust off my memories and help you as much as I can.

Otherwise please take a look at this post Victron/Fronius off-grid PV Energy Dashboard - MQTT and modbus integration - #32 by lsgv

Let me know.

Danke für die schnelle Antwort :smiling_face_with_three_hearts:

Ich habe die Komponenten im selben Netzwerk. Ich habe auch Werte im mqtt, siehe Screenshot.

Es ist gut erkennbar, dass die MPPT Laderegler arbeiten und im eigenen Netz ein Verbrauch ist.
Am Ende des Tages ist es aber nicht möglich, die Summer der Verbräuche zu lesen.

Ich finde nur etwas von den MPPT Ladern “/solarcharger/277/History/Daily/0/Yield” als Zusammenfassung.
Mein Ziel ist es, eine Auswertung zu bekommen, die die Tages-Ergebnisse zeigt.

Ok then, you can use MQTT. To get daily results you can do the following:

  • If you have not done it yet, create MQTT sensor in HA for whatever power flows you need, production, consumption, etc. using MQTT Sensor - Home Assistant
  • From the power (in Watt or kWatt) sensor create an energy sensor (power x time = energy) using the integration integration Integration - Riemann sum integral - Home Assistant
  • Using this sensor, create a daily Utility Meter using Utility Meter - Home Assistant
  • You can use the same energy sensor in Utility Meter to create daily, weekly, monthly etc. sensors so you can keep historical track of your production/consumption.

Let me know if this is clear or if you need any further help.

Danke für deine Mühe :grinning:

Es ist viel zu lesen.
:thinking:
Ich werde sehr bald daran arbeiten und testen, ob ich es kann. Auf dem ersten Blick, kann ich nicht sagen, ob ich weiter komme. Ich werde es dich wissen lassen.
Gruß Guido

ich habe die 3 Seiten gelesen und ich denke, ich verstehe was es für Arbeit bedeutet. Ich werde es jetzt noch nicht tun. Ein Freund hat mir mein System zusammen gestellt. Ich kann es mir nicht erlauben, da einen Fehler einzubauen. :sneezing_face:
Ich werde einfach am Monatsende, die Daten aus dem VRM Portal per Download nehmen und sie ablegen.

Es sind die Daten, die im Grunde das aussagen, was ich von der Anlage wissen will. Ich dachte, es ginge automatisch.
Ich danke für deine Zeit und Mühe.
Evtl. schaue ich in einiger Zeit noch erneut nach der Lösung… Dazu muss ich sicherer mit dem eigenen System sein.
Gruß Guido

I’m using the VRM api and works great except the grab the solar state.
“idSite”: 123184,

  "timestamp": 1683626287,

  "Device": "Solar Charger",

  "instance": 290,

  "idDataAttribute": 85,

  "description": "Charge state",

  "formatWithUnit": "%s",

  "dbusServiceType": "solarcharger",

  "dbusPath": "/State",

  "code": "ScS",

  "bitmask": 0,

  "formattedValue": "Bulk",

  "rawValue": 3,

  "dataAttributeEnumValues":

In States i get result unavailable

Did you get the text to work? Strugeling with the same.

Hello. This thread is quite old and for more than 3 years I’m now using local MQTT or modbus/TCP as implemented by Victron and detailed here
Unless you have a really compelling reason to use the API I do recommend you move to either the MQTT or modbus options.

Hello, yes I know. Old but still valueble for me.
My installation is remote, it’s on a Boat with cellular connection with a NAT ip address… I Use a RasPi that is connected to VRM. My Homeassstiant is running at home, and if I’m not mistaken the MQTT / modus/TCP will not work in my case.
But anyways. I got it to work.
Had to remove the UnitOfMesurment and change the value_template a bit…

Ok, good to know. I found the use of the API convenient in those cases but “cluncky” as best and prone to issues when Victron changed anything and the mappings didn’t work anymore.

I did use the VRM API earlier as my Victron is located in my RV.

I changed to use modbus and this HACS integration. Easy peasy to setup.
sfstar/hass-victron: Integration for Home Assistant to fetch data from the victron gx device via modbusTCP (github.com)

But llike you, my RV is om a Celuar connection so I added ZeroTier addon to Homeassistant, set up a ZeroTier network and added ZeroTier to the VenusOS as described here:
remote access to VenusOS: ZeroTier-One installation on RPi [HOW-TO] - Victron Community (victronenergy.com)
Note that this requere the use of VenusOS Large image as you have to compile ZeroTier on the device.

2 Likes

This topic was opened 5 years ago and except in very particular circumstances is not useful anymore so I wanted to close it but can’t find a way to do that on the forum.
On the subject of integrating Victron equipment with HA here is a short summary for those ending up here:

  1. Use the VRM API as explained in this thread
    When? If your Victron installation is remote and it’s only connection to the “world” is via VRM
  2. Use MQTT as explained in many threads and specifically here
    When? If you’re familiar with MQTT and envision the use of, for instance, Red-Node, for logic programming and automations
  3. Use modbusTCP either using DYI config or using the excellent HACS integration from @sfstar you can find here
    When? If you’re familiar with modbus and like to keep it simple

After having used all 3 methods I am now and for the foreseeable future using modbus because I have other modbus integrations in my HA such as for instance swimming pool filters/clorinator, Fronius inverter, etc. which reduces the number of integration and keeps it simple. But this is a purely personal choice, feel free to test and try and break and share your experiences.

If you want Victron’s opinion please read this post by Matthys Vader on the subject. you can find the complete thread here

3 Likes

Hello, please help??
I somehow tried everything, but:
HOW SHOULD I ADD THOSE SENSORS TO LOVELACE !!
I DON’T SEE ANY ICON ON MY VIEW.
Thank you.

Do you really need to use the VRM API or can you not use MQTT or modbusTCP?

I am using Modbus TCP and it works great. It’s just matter of downloading the Modbus TCP register list from Victron technical info, and then write sensor definitions for selected parameters, for example

  - name: "ESS battery SoC"
    unique_id: "PAkBZRSAZWIeJkdNQ2JwAKFTVsmtzrsd"
    unit_of_measurement: "%"
    scan_interval: 20
    slave: 100
    address: 843
    data_type: uint16
    device_class: battery
1 Like

Please do not close this topic!

If you can use modbus or MQTT this is of course a much better way, but if you use globalLink the VRM api is the only way to integrate.

I have a cabin with solar power only, and being in Norway and in a northfacing slope i have zero sun from Nov - Mar so having anything other than a globallink to watch my system is impossible without draining the batteries.

The globallink use 4g LTE-M to send data each 15 mins directly to the VRM. It use very little energy, but cannot be remotely accessed any other way than by the VRM api.

The globalLlink have a relay so i can turn on my 4g wifi-modem and webcams etc to make quick checkouts and then turn off everything except the globallink again.

BTW the api have a full web interface for testing out all the calls from a browser at

https://vrm-api-docs.victronenergy.com/#/

I didn’t see this in the thread. If its there i apologize.

Very easy to test out all calls, just remember that the tokens should be written without the surrounding “<>” signs (Took me a while to figure that one out…)

-Goffen

1 Like