BottlecapDave / HomeAssistant-OctopusEnergy

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

Estimate Saving Session reward points #616

Open JRascagneres opened 7 months ago

JRascagneres commented 7 months ago

Describe the feature

It would be nice if following a saving session there was an estimated reward field that could be populated per session. There are a couple of websites such as - https://savingsessions.streamlit.app/ (https://github.com/barnybug/savingsessions/blob/main/streamlit_app.py) that are able to calculate the reward you should get from a saving session based on past usage and usage over the saving period.

Expected behaviour

Add an estimated_reward_octopoints field as part of the opted-in session thats are provided on the event.octopus_energy_**_octoplus_saving_session_events sensor. This would populate AFTER the session using previous usage and usage over that period all of which is available through the API.

Use Case

Octopus takes a week plus to calculate this and it'd be nice to get a quick estimate on the value.

Confirmation

BottlecapDave commented 7 months ago

Hello and thanks for the feature request. I'm currently reworking on how data is retrieved based on some requests by OE along with some other features so I don't have time to implement this at the moment. I also personally don't see the need for it as it doesn't have an impact on automations and I can personally wait for the data to become available as I can't see it impacting any automations. However, if you would like it sooner and wish to add the feature yourself, I'm more than happy to accept a PR. However I would hold off until https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/597 and https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/533 are complete as it would rely on those.

The following acceptance criteria should be met

  1. Only calculate for joined saving sessions where the actual data isn't available
  2. We should not double process data required by both https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/533 and this, so we might need to save the target locally and share.
  3. The consumption data for the saving session should favour current consumption data if available and then falling back on previous consumption data
  4. The estimate should be saved locally and retrievd during updates as the consumption data will eventually become unavailable, potentially before OE give the correct reading, and we don't want to process the estimate every time we refresh the events
  5. This should all be done in the saving session coordinator