ottopaulsen / node-red-contrib-power-saver

A Node-RED node to saver money by turning off when the power is most expensive
Other
70 stars 17 forks source link

adding highest price schedule? or help to turn over low to high? #203

Open Tijntert opened 1 month ago

Tijntert commented 1 month ago

Hey, I was wondering if a highest price schedule, or even better picking several highest separate hours is coming?

Thx

CirruZZ commented 1 month ago

Check the documentation here https://powersaver.no/nodes/ps-strategy-lowest-price.html#highest-price

Tijntert commented 1 month ago

Check the documentation here https://powersaver.no/nodes/ps-strategy-lowest-price.html#highest-price

Super! Thx... Searched and searched, but didn't find anything...

:D

Jalle19 commented 1 week ago

If anyone needs an actual schedule with the highest prices (i.e. inverted output values are not enough) then you can pass the schedule to a function node with this:

msg.payload.schedule = msg.payload.schedule.map((s) => {
    s.value = !s.value;
    return s;
});

msg.payload.hours = msg.payload.hours.map((h) => {
    h.onOff = !h.onOff;
    return h;
});

return msg;

and then connect that node to a schedule merger node to create a new schedule with inverted values