I am new to the forum. I'm Wesley, 38 years old and have been working on home automation for a while now. Recently I did an integration with node-red and the PLC. Everything is working well.
Now in Belgium the energy prices are rising enormously, there will be a capacity tariff. This means that you pay for the peaks that you cause.
I have extracted on a site the energy spot price per hour.
These are in a payload in an array
These values are "string" values separated by a comma. I have been searching for a week to convert these values to numbers. What have I already tried:
msg.payload = Number(msg.payload);
msg.payload = Number(msg.payload.vars["1"].value)
msg.payload = payload.replace(",", ".");
(error NaN (not a number))
I have a value per hour, from this I want:
1: the average
2: the 5 highest values (hours are available in topic)
All thanks for the help