BottlecapDave / HomeAssistant-OctopusEnergy

Unofficial Home Assistant integration for interacting with Octopus Energy
https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/
MIT License
612 stars 61 forks source link

First/last slot selection for target rate sensor when rates are the same #990

Closed gcoan closed 1 month ago

gcoan commented 2 months ago

Describe the feature

I've put this as a FR rather than a bug as I don't know whether there is actually a pre-determined result that should be occurring and isn't, and I think there is probably an opportunity to enhance the target rate selection in this scenario:

Octopus agile rates are very flat overnight tonight: image

I've asked for a 3 hour cheapest target rate: image (no min, max or weighting set)

the target rate sensor proposes that the cheapest slot is from 1:30am: image

However from the rates, it would be exactly the same price for 3 hours from 1:00am or 2:00am, being made up of 4 slots @ 0.168945, 1 at 0.15876 and 1 at 0.156765 image

Expected behaviour

Provide the ability to choose in the target rate sensor whether the target rate is the first set of lowest price slots. Currently its chosen the mid-point, and this maybe could be an option as well.

May argue that this is a bug and the target rate sensor should already be choosing the first set of matching slots if the 'latest period' switch isn't on.

Use Case

I use the 3 hour target rate sensor for the tumble dryer, other people may for example use it for electric heating or immersion heater. All things being equal I'd have a preference for the first matching slot so the clothes are ready sooner, but others may want it later (e.g. hot water ready as late as possible)

Recognise on agile the flat rates are unusual, but on other rates with predictable patterns this could be more useful

Confirmation

BottlecapDave commented 2 months ago

Hello and sorry for the late response, I've been away for a couple of weeks. This should already be picking the earliest time periods if you e not stated otherwise. I'll try and recreate this locally and get back to you.

BottlecapDave commented 1 month ago

I think I've found the issue (accuracy related) and should be fixed in the next release. You can try it now with v13.0.0-beta.1 or you can wait for the final release.

BottlecapDave commented 1 month ago

The fix for this issue is now available in v13.0.0.