Code Monkey home page Code Monkey logo

victron-vrm-api's Introduction

This node makes it easy to use the VRM API for data retrieval. Though not all possible API calls have been implemented, it can be used for retrieving and creating alarms and fetching installations statistics. It can also be used to retrieve the solar forecast data.

VRM API flow

In order to allow the node to query your site, an access-token needs to be created and filled out in the configuration node.

Inputs

  • payload (string|number|json) - the trigger to query the VRM API

Outputs

  • payload (json) : the VRM answer

The output of the answer depends on the selected configuration. See the VRM API documentation in case you need assistance with interpreting the output.

Configuration

  • Name (string) : The name of the node
  • VRM (config) : The configuration node
  • VRM site id (number) : The site to query. Note that this is the multi-digit number you see in the url of your vrm-site like this: https://vrm.victronenergy.com/installation/123456/
  • API type (string) : The query type
  • Verbose (boolean) : Show the used url in the debug tab?

There are currently 4 API types to choose from:

  • Users
  • Installations
  • Widgets
  • Dynamic ESS

Depending on the API type, more or less extra fields appear.

In case of installation stats there appear some extra configuration options

  • Attribute (string) : Which attribute to fetch
  • Interval (string) : Time between retrieved data points
  • Start (integer) : Timestamp from which to fetch data
  • End (integer) : Timestamp to which to fetch data

In case of installation `dess`` there are even more configuration options.

VRM API edit panel

Note that instead of filling out the number of the VRM site id for installations and widgets in the box, you can also use context variables, e.g. {{flow.siteId}} or {{global.vrmId}}. This allows to query the site that has been set in this context field. Of course you need to make sure that context contains a valid VRM site id first.

Examples

There are several examples included in the package. In order to use them, import them via the victron-vrm-api examples dropdown on the Import nodes page (accessible via the menu or by pressing ctrl-i).

References

Please use either the issues on the GitHub site or the Node-RED space on our community for questions, troubleshooting and suggestions.

victron-vrm-api's People

Contributors

dirkjanfaber avatar codeworkx avatar blieven1 avatar gizmocuz avatar teefixx avatar

Stargazers

Alex Imbrea avatar  avatar Thomas Taugs avatar  avatar Tobias Wasner avatar Kevin avatar  avatar SL70 avatar

Watchers

 avatar Tonny Andersson avatar

victron-vrm-api's Issues

Idea: Use Variable in "VRM Site ID"

May thers a possibility to also use a Variable into VRM Site ID like {{flow.siteID}}? I often copy Boards from one to another Dashboard. So if i can set a global Variable i have to set it only once:-)

image

[BUG] Consumption results generated by API Call do not match results from VRM Portal

Description: When using the Node Red VRM API Node, to pull consumption data, the data received does not match the data seen in the VRM Portal.

To Reproduce: Create a Node Red Flow that pulls consumption data for a 24 hour period, with interval set to hour and dumps the data to a debug node. Compare the data received to that found on the VRM portal of the same installation. There is no correlation between the values on the interval basis nor the daily total.

Node Config:
image

Expected Behavior:
It is expected that the values would coincide, possible with some slight variation due to exact reporting minute used for each interval.

ScreenShots/Data:
Attached are the reported data via Node Red and that from the VRM Portal:
Consumption Message:
{"_msgid":"51c0ea40d0c8bc83","payload":{"success":true,"records":[{"instance":0,"stats":{"consumption":[[1726232400000,2340.0627146176203,451.48500382741,3695.79197177776],[1726236000000,633.6783185120647,200.53703563658,1556.30866949656],[1726246800000,621.5253134838861,521.93499347846,733.65768744612],[1726250400000,548.02971855667,449.98365865676,669.8383395457299],[1726254000000,541.1812281283009,452.74266362294,621.32199379492],[1726257600000,550.0601352092624,484.8136607314,600.66165539781],[1726261200000,521.3295299424075,386.07800493436,600.8796688236],[1726264800000,449.58033829035,424.2216714301,467.74666887318],[1726200000000,354.97222222222246,275,438],[1726203600000,301.19444444444497,215,401],[1726207200000,362.72222222222246,288,406],[1726210800000,348.4722222222217,320,390],[1726214400000,368.11111111111086,283,406],[1726218000000,330.3846153846162,269,399.33333333333],[1726221600000,296.0335958888626,212.4959996359,325],[1726225200000,376.3990838408275,312.02632753623,438.75133549027],[1726228800000,403.9808630951141,326.04733296808,455.03934767469],[1726239600000,390.3878514469209,237.89335232099,477.20130997054],[1726243200000,386.54523236641086,320.19435554886,467.66433725897]]}}],"totals":[{"instance":0,"totals":{"consumption":10124.650760985538}}],"options":{}},"topic":"installations stats 241800"}

VRM Portal Data:
image

There is no easy way to capture hourly data from the VRM Portal, however, the total listed at the bottom of the image is shown as 8.4kWh and is shown as 10,124 Wh in the Data (message). These were pulled at the same time.

Hardware:
Cerbo GX

Software:
victron-vrm-api version: 0.2.6
Venus OS Version: V3.40

Some additional datapoints:
I re-tested for Solar Yield, Solar Yield Forecast and Consumption Forecast, and all of these were either the exact same or very close between the API reported data and the information displayed within the VRM Portal.

I also retested, with the following settings:
image

and the results are even more wrong. The data reports back as:
{"payload":{"success":true,"records":[{"instance":0,"stats":{"consumption":[[1726200000000,702.7907418259276,200.53703563658,3695.79197177776]]}}],"totals":[{"instance":0,"totals":{"consumption":702.7907418259276}}],"options":{}},"_msgid":"86ce4428aed8e7f6","topic":"installations stats 241800"}

702 total Wh (bolded)? Also, the 4 fields (that are not identified in the documentation), show as 1726200000000,702.7907418259276,200.53703563658,3695.79197177776.

I bring this up because it feels like a secondary bug to the first one identified.

Please let me know if any additional information is required.
Mike

[BUG] `type` and `attributeCodes` are sent twice in the URL

Describe the bug
ditto

To Reproduce
Steps to reproduce the behavior:

  1. Using node 'VRM API'
  2. Select Installation stats and Consumption
  3. Enable verbose
  4. Get an URL like: https://vrmapi.victronenergy.com/v2/installations/XXX/stats?type=custom&attributeCodes[]=consumption&type=custom&attributeCodes%5B%5D=consumption&...

Expected behavior
The two fields are sent once

Software (please complete the following information):

  • victron-vrm-api version: 0.2.6
  • Venus OS version: v3.42

Additional context
Add any other context about the problem here.

SolarToGrid missing in API

Hi there

I just crosscheck the Values by VRM Portal and API. there is a small different and one Value i miss complet.

(1) in VRM Portal i see Solar2Grid = 1.6kwh
Solar2Batterie is correct as in VRM, also SolarDirectUse is same

(2) Strange is that in Solar_Yield the Value is 98.7 (so for me it looks like 97.0 + 1.6 from Value to Grid = arround 98.7)

Would be possible to have also Solar2Grid?
and do some wrong by Solar_Yield?

solar_to_grid

Invalid input pattern

@dirkjanfaber Since Update 3days ago i have on nodes i edit following error: Invalid input pattern

vrm_api

vrm_api1

Only if i open an exist Node and close it again it happens
What i doo wrong?

Improvement Request

Hi @dirkjanfaber,
I have used this node for getting the solar PV forecast, and would suggest that you add options to set the start and end times to the request parameters, since leaving them off only gives the defaults timespan which is from the time one day ago, to the time of the request.
Therefore, you cannot see the whole forecast for say, today, which requires a start time of midnight at the start of today, and an end time of midnight at the end of today (I see also that these timestamps are integer seconds, and not milliseconds - the API documentation sadly does not actually specify this - they just say a timestamp).
BR, Steve

Values not clear

Hi Dirk,
Could you please give some explanations for the different values for example:

vrm_solar_irradiance_fc: 170.16666666666666
vrm_pv_charger_yield_fc: 8155.842231439
vrm_solar_irradiance:: false
vrm_pv_inverter_yield_fc: false

Also the meaning of 1 hour, 2 hours, 1 day.
Thanks!

Properties available parameter/values

Using attribute="installations stats", attribute="Solar direct use" and Interval="years" the start field can be defined to "- 1 week" only.

This delivers the total of one week not the total of a year.

Same behavior with e.g.attribute="Solar to battery"

Would be nice to select by starting "-1 year" in this way.

Any ideas or plans?

Fetch (and map) GPS data

Add https://vrm-api-docs.victronenergy.com/#/operations/installations/idSite/gps-download, making it easy to retrieve and map the gps data.
Also see community post https://community.victronenergy.com/questions/301242/how-can-i-se-my-gps-tracks.html

After that, it will still need to be put on a map, which probably can be done by https://caltopo.com or so. Also check https://www.youtube.com/watch?v=ywljyO74MjE / https://flows.nodered.org/flow/fad2fff9d5a66fe3be672ec2287736b2, which uses an alternate method on putting the data on a map.

Custom request

@dirkjanfaber I dont get all the values I was hoping for using the "diagnostic data", since it is limited to 100. And I cant figure out how to send a spesific request with a inject node. For instance this request : https://vrmapi.victronenergy.com/v2/installations/NNNNNNN/widgets/Status
I am quite new to this, so sorry if this is something I should have picked up my self, byt can someone explain how to inject a custom request?

Timespan request - tomorrow

Is it possible to have a timespan option which would return the forecast for "tomorrow" similar to what is returned via the VRM web interface? Use case; during the day you want to lookup the forecast for the whole of tomorrow, not now+24hr which may cut off some of tomorrows yield depending on when you run the query.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.