Calculate rainfall per 24h

You have the function in the example I already gave you that has all the three parameters you want as different variables. So it should be very easy to follow the examples in the documentation to get each variable sent to a different output.
The best way to learn is t play with it, make mistakes, so you understand what works

I read it, but didn't understand it. Sorry.

You are outputting as payload " Total Rain =772.1 Period Rain0 Rain Today772.1". But I can't find a function to separate it, so 3 payloads then. Do you have a tip for me? Thanks a lot!

Don't look at the output, look at the function that creates it. (Which is also the function that you need to modify)

If you don't understand that function there are lots of guides/tutorials for javascript on the web.

Theres also a great introduction to node-red that you can follow here: http://noderedguide.com

I have to translate everything first, because english is not my mother tongue. maybe i will recognize what i have to do to get the values into the dashboard ...

Wenn Sie die Grundlagen von Javascript verstehen, sind sie klar.
Ich empfehle Ihnen, eine Anleitung für Javascript in Ihrer Muttersprache zu lesen.

https://wiki.selfhtml.org/wiki/JavaScript/Tutorials - zum Beispiel.

So, I've read through various publications and come to the conclusion that I don't understand it. Apparently I am already too old and I simply lack the basic information what I have to do.

But don't worry, I won't become a programmer anymore :slight_smile:

Thanks for your help, the flow also works without the values in the dashboard.

All the best for you!

Florian.... in case you are still seeking this I found a node in the library which helped me with a power meter. It has 3 modes but the one you are looking for is the difference mode between start value and last value within a time bracket.

It is called Totaliser and is in the node-red flows library

1 Like

Thx Tony!

I will take a closer Look in the next few Days ...

Greetz!

if you use it, see if you can determine if multiple instances work. I have found I can use it one time in a flow (to calculate the difference between start value and end value in a power meter metric, but if I place a second instance it seems to replicate the value of the initial one.
I suspect I'm missing something but scratching my head over it.

You might want to check the source code for that node. If the variable being used is inside the register node function, it will be per-instance. If it is outside, it will be per-Node-RED instance instead of per-node instance.

What should I look for in the code?
This is what I found as far as looking for the source code.
https://npm.runkit.com/node-red-contrib-totaliser/totaliser/totaliser.js?t=1559719711123

As @TotallyInformation guessed the declaration of total (line 33) is outside the main node declaration (line 39) so is one total per Node-RED , and not one per node.

You could raise an issue on that nodes project page and ask if that is intentional (it might be) or if not, could they fix it.

Well, I'm glad that something good has come of all of the hours I've spent wading through the source code for nodes in order to try and improve uibuilder :wink:

1 Like

I'll head over to there and make some inquiries... I'm glad I wasnt going crazy(ier)

Good spot. Don't know what I was up to that day! Pushing a fix today

2 Likes

thanks for being so responsive.

The totaliser node has been updated! Hopefully that will work now :slight_smile:

1 Like

node-red-contrib-totaliser

I think the update may have caused an issue where setting msg.payload to 'reset' (to clear the total and restart the interval timer) causes a ReferenceError: "startTime is not defined"

    node.on('input', function (msg) {
      if ('payload' in msg) {
        if (msg.payload === 'reset') {
          startTime = Date.now();
          node.total = 0;
        }

should it not be:

      node.startTime = Date.now();

I've just started using Node-RED and not much JavaScript so apologies if I'm just making some stupid mistake with Node-RED.

Hi,
As it's not one of the core nodes you will have to contact the author direct, but yes what you suggest makes sense.