Send a value to influxdb in a defined time interval

I have an electricity meter which outputs the current flow via blink code. This arrives via mqtt in node red.
If little current flows, the time between the incoming values is greater, if much current flows, the values arrive in shorter intervals. See screenshot.
Now I would like to write this so to speak smoothed after influxdb. So that there for example every 30 seconds a value is written. And not with much current every 5 seconds and with little current every 2 minutes or so.
Has anyone done something like this in node red?
I can program some C++ (arduino) but I am not able to write complicated functions in node red.
If there is someone here who can do this easily and who doesn't have to spend a lot of time on it or who already has it as a template, I would be very happy.

Thanks a lot!

Why do you want to do that? Why not write all the data as it comes in?

hm, isn't it too much? I would like to keep the data for a year.

If you average 1 record a minute that's about half a million in a year. My database of choice is mariadb and I would not be too concerned to find half a million records. I would pay attention to appropriate indexing though.

My influx dB experience is less positive, but other people use it very successfully and it has the ability to summarise aged data.

The idea of having a database, any sort of database, and aggregating, averaging or otherwise falsifying the data before putting it in the dB seems bonkers to me.

You could, if necessary have a raw input table which you move to a summary table once a month.

I guess thats more or less what influx offers.

What hardware and OS are you running on, and what storage device?

Are you sure it's the 'current'?
505.62 Amps sounds an awful lot...

It sounds more like 'Power' - ie Watts?

Just to get it right, the current you are interested in is directly determined by the frequency of your input signal (pings)? Is this linear?

I think measuring the time between pings and simply store that time is a good option. Allows to calculate anything afterwards and you have access to not-smoothed data.

Alternatively, you could probably count the pings in a given timeframe and correlate that number with your current. This however would give you more like an average, because you would need to choose the timeframe longer than the longest pause between pings.

If the values of the current are simply arriving in variable frequency (i.e. the current is not determined by the frequency) and you want it evenly written to a db, you could use my rate limiter in queueing mode with a queue size of 1 and keeping the newest. Would give you a steady flow of the most recent value.

Ok guys, I am overwhelmed.
Thank you so much for all of these replys.
@Paul-Reed of course, it is power not current. My translator screwed it up.
The InfluxDB runs at a raspberry pi. I should just wait and see how much and fast the database grows.

Really thank you such much. In this forum, you always get help instantly.

Which model of pi?
Also you did not say what sort of storage device. SD card storage is not ideal for Influxdb. It does a lot of data housekeeping which can be onerous for the card. However with the very small amount of data you are storing it will probably be ok, particularly if the card is of large capacity so there is plenty of space for the card to do wear levelling. It is better though to use something like a USB disk if you can.