MattJeanes / TeslaMateAgile

Integration to automatically fill in prices for charge data captured by TeslaMate for smart energy providers
MIT License
76 stars 9 forks source link

Option for setting negative prices to 0 in Energinet #60

Closed stauffenberg2020 closed 7 hours ago

stauffenberg2020 commented 4 days ago

Hi @MattJeanes ,

I was wondering if you can make an option for setting the negative prices to 0 in the Energinet calculation part.

For eg. If the price from 10:00 to 11:00 is -0.1 and 11 kw is charged during this hour,

The my calculations is like

=[11 kw {max(-0.1, 0) + Energinet__FixedPrices__Prices__0=00:00-24:00}] Energinet__VAT

MattJeanes commented 4 days ago

Hey, so if I understand correctly you just want the option so that the prices cannot be calculated as below zero and would clamp to zero instead?

Would this apply to the entire calculation including the fixed price or only to the raw data from energinet?

Also just so I can get a bit more of an understanding, why is it you want this option?

Thank you!

stauffenberg2020 commented 4 days ago

Hey, so if I understand correctly you just want the option so that the prices cannot be calculated as below zero and would clamp to zero instead?

That is correct. I just want an option so that raw negative prices can be clamped to 0

Would this apply to the entire calculation including the fixed price or only to the raw data from energinet?

This clamping should only apply to the raw data from energinet (for my use case atleast or according to Monta's way of sending bills)

Also just so I can get a bit more of an understanding, why is it you want this option?

My electricity provider along with Monta is doing calculations like this. Hence I would prefer the same running in my teslamateagile

MattJeanes commented 4 days ago

Okay, I gotcha! Sounds like your use case could certainly apply to others as well then, and should be a relatively simple change.

I'll put this in for you hopefully sometime today but soon if not 😁

stauffenberg2020 commented 1 day ago

Hi @MattJeanes , Did you had some time to take a look at this request?

MattJeanes commented 21 hours ago

Hey @stauffenberg2020, sorry - manic week! I've done this now in version v1.15.0 if you'd like to try it out!

The new configuration option is Energinet__ClampNegativePrices=true/false.

Let me know how it goes and I'll close the issue if you're happy.

stauffenberg2020 commented 7 hours ago

Hi @MattJeanes , I confirm that the new option works flawlessly. Thanks a ton for your time in updating the code :)

MattJeanes commented 7 hours ago

Fantastic! Glad it's all working 🙂 no problem at all