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

Being able to visualise capacitor setpoint in Lovelace #174

Open krispek opened 8 months ago

krispek commented 8 months ago

I would like to visualise the impact of the capacitor module on the setpoint of my thermostat in a similar way as is done in the Lovelace visualisation example.

However, there's a couple of things that impede(d) me:

I am able to resolve the first issue with this code in a function module which converts the delta into an absolute temperature:

const temperatureDeltas = msg.payload.temperatures;

// Get the setpoint from msg.payload.config.setpoint
const setpoint = msg.payload.config.setpoint;

// Initialize an array to store the absolute temperatures
const absoluteTemperatures = [];

// Loop through each temperature delta and calculate the absolute temperature
for (let delta of temperatureDeltas) {
     const absoluteTemperature = setpoint + delta;
     absoluteTemperatures.push(absoluteTemperature);
}

// Update msg.payload.temperatures with the absolute values
msg.payload.temperatures = absoluteTemperatures;

return msg;

However, adding a time to this exceeds my (limited) coding knowledge.

I see two potential solutions, which are both not ideal:

Is there anyone who has done this as well?

Additionally, this might also resolve #94 because this will deliver a schedule that I can use for my thermostat. :)