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

Reset Capacity part of grid tariff #139

Open haavardNO opened 1 year ago

haavardNO commented 1 year ago

I think this is more of a question than a bug. But here it goes.

I am trying to implement the "Capacity part of grid tariff" and since I am in the testing phase it would be verry helpful to reset the monthly totals. Since it now seems that PS will not reduce the consumption because it already thinks I am at the next capacity level. Is this possible?

ottopaulsen commented 1 year ago

Here is a trick you can use:

Open the Calculate values node. In the middle there is a bunch of lines like this:

const highestPerDay = context.get("highestPerDay")
const highestCounting = context.get("highestCounting")
const highestToday = context.get("highestToday")
const currentMonthlyMaxAverage = context.get("currentMonthlyMaxAverage")
const hourEstimate = msg.payload.hourEstimate
const timeLeftMs = msg.payload.timeLeftMs
const timeLeftSec = timeLeftMs / 1000
const periodMs = msg.payload.periodMs
const accumulatedConsumption = msg.payload.accumulatedConsumption
const accumulatedConsumptionLastHour = msg.payload.accumulatedConsumptionLastHour
const consumptionLeft = msg.payload.consumptionLeft
const averageConsumptionNow = msg.payload.averageConsumptionNow
const currentHour = msg.payload.currentHour

For testing you can replace the right side of = to a value you want. Then this value will be used in the calculations. Remember some of them are arrays, so they are a little tricky to get right. You can set a debug node on the output from the node to see how the values are written. In debug output, you can copy the whole thing to clipboard and pick out what you need.

This is what I do when I need to test something specific.

haavardNO commented 1 year ago

Thanks for getting back to me so quickly. I am a bit new to coding so sorry for the beginner questions. I tried to change the highest_today but did not get the values in HA to change, it also started to report errors on the set entity node. Do you have any tips for values for getting the save nodes triggered with 2-4kw consumption?

And is there a way to reset cap step? For some reason mine is now at 15, even if I only have 2 hours past 10 according to the tibber app.

And lastly. When I get timeout from the "get live data", is that due to tibber server issues?

Skjermbilde 2022-12-21 kl  20 26 17
haavardNO commented 1 year ago

@ottopaulsen I am trying to alter the values to "reset" the behavior of the flow. This is because it has miscalculated and thinks I am on the 15kwh limit. I have connected the debug node to the calculated values node, but I don’t see what part of the output I should use in the code. I am guessing that some of the values below would reset the current step?

const highestPerDay = context.get("highestPerDay") const highestCounting = context.get("highestCounting") const highestToday = context.get("highestToday")

image

ottopaulsen commented 1 year ago

What makes you think it is a miscalculation?

haavardNO commented 1 year ago

I checked with the tibber app, and I only have 2 hours that is over 10kwh. However, PS thinks I am at the 15kwh limit.

ottopaulsen commented 1 year ago

That is correct, you only have two hours over 10kWh, but the third is just under 10, so the average of those three is over ten, and that is what counts.

haavardNO commented 1 year ago

@ottopaulsen that is absolutely correct. I thought it was the average of the hours above the limit. Thanks for the correction. But I am still not able to “trick” to PS to try to limit power to see if the rest of the logic works. Any suggestions on how to trick it to limit at 5 kwh for instance?

haavardNO commented 1 year ago

@ottopaulsen I have changed the settings for steps to "const STEPS = [1, 5, 10];" And changed const currentMonthlyMaxAverage = 0.5. Nothing is happening, should PS start to limit power when I use above 1kw now?