mampfes / ha_epex_spot_sensor

Provides helper sensors for EPEX Spot integration.
MIT License
48 stars 4 forks source link

Feature request: Flexible duration -> flexible start time? #13

Closed Adminius closed 4 months ago

Adminius commented 4 months ago

Hi mampfes!

Thanks for #12 !

My use case: PV charged my home battery to x %. I know, that I need ~y % per hour. So, I can calculate duration. Let say 15h my battey can last. Epex Spot sensor gets this 15h to calculate times to discharge the battery (at highest prices starting 15:00 and ending 10:00 next day) Works as expected. But, the calculation=duration changes with state of charge because the battery discharges at highest price as expected. now we have 23:00, duration dropped to 8h. And your sensor calculates new times, but also for already passed times: image My expectation is: 8h should be counted from now (and not from 15:00) until 10:00 But now I go sleep, and the SoC will not drop so fast -> duration can increase again, but this will not realy help if the past high prices will be counted.

So, my feature request is: start time can set to "now" if flexible duration is used

EDIT: my heat pump discharged the battey, and now only 6h are "left", but the sensor will get 2h only (7:00 - 9:00): image

Expectation would be from now on: 23:00-1:59 and 6:00-9:59 image image

EDIT2: it is morning, 29th of Feb.... 28th doen't help me anymore... hm: image

mampfes commented 4 months ago

Hi, this is an interesting new use case. I will think of it.

Just to ensure that I got you right: Would it be ok for you if you still have to configure the latest end time? Or do you need s.th. like: The cheapest 3h in the next 10h or so?

Adminius commented 4 months ago

I would say for the beginning it's enough to provide start and end time, example: 15:00 until 10:00 Than via check box: use "now" time activate new function: if duration changes calculate prices between "now" and end time if "now" is after "start"

But your idea sound also interesting, dynamic duration between now and dynamic end :)

mampfes commented 4 months ago

Please have a look at version 1.2.0. I didn't add an extra checkbox but changed the behavior in general (because the previous behavior didn't really makes sense).

Adminius commented 4 months ago

Perfect! Looking good. First tests are as expected!