question

sungrid avatar image
sungrid asked

Update interval of Victron output node in Node-RED flow

Hi,

I'm sending all data from NodeRED to the InfluxDB cloud. Because of costs, I need to reduce the update interval to 30 secs. Is there any way to configure it? (config file which survives Venus OS update)

Thx

Node-REDmodifications
2 |3000

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

4 Answers
Dirk-Jan Faber (Victron Energy) avatar image
Dirk-Jan Faber (Victron Energy) answered ·
2 |3000

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

sungrid avatar image
sungrid answered ·

This is not useful because messages are received randomly. Some every xy seconds, some when values are changed. If I limit to for example 100 messages per 30 seconds, first 5 seconds, some fields will be updated several times and some never, and another 25 seconds will be silent. I need a batch time-based function (as implemented in nodered), but with averaging every field in meantime.

2 |3000

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

Dirk-Jan Faber (Victron Energy) avatar image
Dirk-Jan Faber (Victron Energy) answered ·

In that case I would store the irregular updating value to a context. E.g. flow.myvalue.

And have an inject node running every 30 seconds that reads flow.myvalue into msg.payload and passes that to the influxdb node. Something like:

1670764913124.png

Not sure what you mean by averaging every field in the mean time though. You might want to take a look at https://flows.nodered.org/node/node-red-contrib-rate-avg for that.

See https://gist.github.com/dirkjanfaber/188d5abb4dc134b6d31987783739bae3 for the flow of the above example.


1670764913124.png (71.6 KiB)
2 |3000

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

sungrid avatar image
sungrid answered ·

I would have to configure the change node for each field separately. In addition, Victron only sends payload and the field name is in msg.topic. I solved this using node-red-contrib-calculate

1 comment
2 |3000

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

Dirk-Jan Faber (Victron Energy) avatar image Dirk-Jan Faber (Victron Energy) ♦ commented ·

Instead of using a change node, you can also use a simple function doing something like:

global.set(msg.topic.replace(' - ', '').replace(/\//g, '.'), msg.payload);
0 Likes 0 ·

Related Resources

Webinar Part 1 - Intro to Node-Red

Webinar Part 2- Basic Palettes

Webinar Part 3 - Advanced example

Node Red Community Space (normally hidden)

Venus OS Large (Node-RED) manual

Victron Node-RED github readme

Victron Node-RED custom nodes docs

Experiments, Modifications and Adaptions. Mods (Modifications) can be made to Victron Software by the Community. Please use the modifications space for enthusiasts who want to push what is possible, without official Victron Support.