node-red-contrib-power-saver
node-red-contrib-power-saver copied to clipboard
Payload has no data
Hello :-)
I an using NodeRed integrated i ioBroker to get prices from NordPool via this api: https://github.com/zinen/node-red-contrib-nordpool-api-plus
This works well, exept for the Price Receiver that reports "Payload has no data".
Attached the output from the NordPool api plus and the output from the Power Saver Price Receiver:
Is there a way to make this work? Thank you
Here is what you can do:
You can replace the Price Receiver
with a function node that converts the Nordpool prices to the right format. It is a little tricky to convert the date format, but I found some code for that here.
Set up nodes like this:

In the function node Convert Nordpool Prices
use this code:
const nordpool = msg.payload;
function toIsoString(date) {
var tzo = -date.getTimezoneOffset(), dif = tzo >= 0 ? "+" : "-",
pad = function (num) {
return (num < 10 ? "0" : "") + num;
};
return (
date.getFullYear() + "-" +
pad(date.getMonth() + 1) + "-" +
pad(date.getDate()) + "T" +
pad(date.getHours()) + ":" +
pad(date.getMinutes()) + ":" +
pad(date.getSeconds()) + dif +
pad(Math.floor(Math.abs(tzo) / 60)) + ":" +
pad(Math.abs(tzo) % 60)
);
}
const payload = {
priceData: nordpool.map((h) => {
const date = new Date(h.timestamp);
const start = toIsoString(date);
const value = Math.round(h.price * 10) / 10000;
return {
start,
value,
};
}),
};
return { payload };
Then you have prices you can send to any strategy node.
However, the nordpool-api+
node only gets the current day. Do you know how to get the next day?
However, the
nordpool-api+
node only gets the current day. Do you know how to get the next day?
Update to version 4.4.0 for easy or above of nordpool-api+
or input msg.date
= date of tomorrow.
E.g.:
todayValue = new Date()
tomorrowValue = new Date(todayValue.setDate(todayValue.getDate() + 1))
msg.date = tomorrowValue