mampfes / ha_epex_spot

Adds EPEX Spot data to Home Assistant.
MIT License
130 stars 19 forks source link

Feature Request: Rank calculation for today+tomorrow combined #101

Closed Adminius closed 6 months ago

Adminius commented 7 months ago

Hi,

in #82 rank was implemented. That is very cool! Thank you!

I'm trying to implement smart battery charge/discharge to for dynamic electricity prices. I' already using rank to do it and if works mostly perfect. But here we see edge case:

image

Let's assume it is 12. January 12:00, the highest price for "today" is already gone (8:00-10:00) but I still have some kWh in the battery. So, if I have the rank for the next 24h, I could discharge also at 17:00-19:00, because highest ranks would be at 17:00 and 18:00

Another case:

image

at the morning of the next day it's more expensive because it more expensive as todays evening. I know, the next day prices maybe not available an one moment, so the ranks should be given for Future available hours and than recalculated if new prices are available.

I’m' still not sure if "all future prices" or "next 24h future prices" (maybe both?)

Let's assume it is now 7. Jan 16:00, future prices are known. With both possibilities + solar forecast I could decide if the battery should be discharged at 8:00-10:00 at 8. Jan (24h case and solar can produce some kWhs for later hours) or at 17:00-19:00 on 8. Jan, because no solar production will be available on this day.

Or are there any tricks how to achieve it?

mampfes commented 7 months ago

Have you already tried the new EPEX Spot Sensor? https://github.com/mampfes/ha_epex_spot_sensor I think some of your cases can be handled cleverly with this.

Adminius commented 7 months ago

not really, becuase the epex spot sensor creates a sensor with fixed time period. e.g. 2h.

In my case, I know that I need 10% SoC of my battery per hour, I know that I can discharge it until 20% and I know that it has know 66% SoC. That means => (66-20)/10 = 46/10 => my battery can last around 4.6h. my actual solution is: 23 (highest possible rank) - 4.6 = 18.4. So discharge battery if sensor.epex_spot_data_rank >18.4

Now, let's asume, there information, that we have e.g. 33 ranks from now on (because we have today and tomorow prices). My formula would be like: sensor.epex_spot_data_max_2day_rank (33 in this case) - 4.6 (hours battey can last) = 28.4

So, I will discharge the battery today and/or tomorror on ranks higher than 28.4 (sensor.epex_spot_data_2day_rank). My automation checks the SoC and price changes. So, if the battery discharge to quilckly, the "rank from" can be adjusted. It can also stop the discharing, because it's now lower rank.

EDIT: it's now 14:20: image

Now I have 100% in the battery, up to 8h where I can discharge it until it hits 20% Today implementation: highest ranks would be at 17:00 and 19:00 and 21:00 next 24h: 7:00-10:00 (3h) and today + tomorrow: (24h tomorrow +10h today = 34 Ranks from now on): 15:00-23:00 (8h) + 7:00-10:00 (3h) + and todays 21:00, 19:00 and 17:00 Solacst claims a lot of PV production for tomorrow. I will use "next 24h" rank and discharge today at 17:00, 19:00, 21:00 and tomorrow 7:00-10:00 and some hours in beetween to get the battery almost empty.

Any other Ideas?

Adminius commented 6 months ago

with flexible duration in EPEX Spot Sensor my FR is solved: https://github.com/mampfes/ha_epex_spot_sensor/issues/10