node-red-contrib-power-saver icon indicating copy to clipboard operation
node-red-contrib-power-saver copied to clipboard

Being able to visualise capacitor setpoint in Lovelace

Open krispek opened this issue 1 year ago • 2 comments

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:

  • the 3rd output does not really produce the schedule. It does deliver a delta per minute though
  • The delta per minute does not come with a exact time like the (binary) lowest price module does

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:

  • adding a exact time for each delta. I think this would be a breaking change though, and produces a lot of additional data
  • adding the setpoint (and maybe the delta) in the trade information. However, this is not really trading information

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. :)

krispek avatar Oct 19 '23 08:10 krispek