node-red-contrib-power-saver
Version:
A module for Node-RED that you can use to turn on and off a switch based on power prices
28 lines (25 loc) • 640 B
JavaScript
function makeFlow(logicFunction, outputIfNoSchedule = true) {
return [
{
id: "n1",
type: "ps-schedule-merger",
name: "test name",
logicFunction,
outputIfNoSchedule,
schedulingDelay: 10, // May need to increase on a slow computer
sendCurrentValueWhenRescheduling: true,
wires: [["n3"], ["n4"], ["n2"]],
},
{ id: "n2", type: "helper" },
{ id: "n3", type: "helper" },
{ id: "n4", type: "helper" },
];
}
function makePayload(strategyNodeId, hours) {
const payload = {
strategyNodeId,
hours,
};
return payload;
}
module.exports = { makeFlow, makePayload };