BottlecapDave / HomeAssistant-OctopusEnergy

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

setting target rates before 4pm and after middnight not working, even when data available #942

Closed f1wade closed 1 week ago

f1wade commented 2 months ago

Describe the bug

If I set the min target time at 15:59 and max as 23:01 it will fail saying: Target time not fit for agile tariffs. Please consult target rate documentation for more information.

but the times are all available at its 16:15pm, and I want it to include 1600 + in an automation.

But If I put 16:00 and 23:01 it will work, and if I put 15:59 and 23:00 it will work.

Can this be looked into why its throws this error, when the data is available to work this out.

I am on v8.2.0 so this may have been fixed, I'll update and find out in time. but if anyone has knowledge please add a comment.

Reproduction steps

added

Expected behaviour

to work out the target rates

Tariff Code

TODO

Integration Version

v8.2.0

Home Assistant Version

todo

Fresh Install?

Not specified

Home Assistant Logs

todo

Confirmation

BottlecapDave commented 2 months ago

Hello. This is by design. The reason can be found in the docs and is due to a combination of reasons

This caused issues in the past where the sensor would pick the best time, but the best time could have been at the start of the evaluation period and therefore had already passed. This resulted in the sensor looking like it had not turned on and missed the selected times. This was added to safeguard and prevent those scenarios.

What are you trying to achieve during these times?

f1wade commented 2 months ago

That's interesting @BottlecapDave, sounds like your doing that too stop almost the thing in trying to do.

So I'm trying to re-evaluate based on battery forecast, and if at 4.05pm it thinks it needs to charge overnight, it'll go back 30 mins and cover till 9am, so then if the 4pm - 430 slot is the cheapest it'll start charging straightaway. I have 2, 1 till 4pm and 1 till 9am. But the pre 4pm till after midnight, won't even set, even when all day is available. But if it wasn't it could still set so then when data is available it would recalculate.

BottlecapDave commented 1 month ago

But the pre 4pm till after midnight, won't even set, even when all day is available.

The data might be available when you setup the sensor, but it won't necessarily be available the next day or next week when the sensor re-evaluates until after the start time, and as mentioned might pick a target rate time that is in the past and then it potentially won't turn on for the required hours. The data will only be available until 11pm until sometime after 4pm when it retrieves the next periods worth of rates.

I have 2, 1 till 4pm and 1 till 9am.

Why can't you do 16:00-16:00 for one and 16:00 to 09:00 for the other?

f1wade commented 1 month ago

@BottlecapDave maybe I didn't detail enough, I have an automation that sets these values when it calculates it will need charging, and I only set it to 30 mins before now, so the earliest half hour would be the current half hour. So it would turn on straight away, but usually it over 6h later in the middle of the night, but sometimes it will take a charge at 340pm till 4pm.

I just think it should be allowed, or have a setting to turn it off, the n if users are aware they can use as they want, and should understand the pros and cons of settings.

BottlecapDave commented 1 month ago

I have an automation that sets these values when it calculates it will need charging, and I only set it to 30 mins before now, so the earliest half hour would be the current half hour. So it would turn on straight away, but usually it over 6h later in the middle of the night, but sometimes it will take a charge at 340pm till 4pm.

If this automation is always run at 16:05, then this could just set the target rate sensor with a start of 16:00. If this automation runs at several times during the day, then the start/end time could be adjusted based on the time (e.g. if before 16:00 then start/end is now minus 30 minutes/16:00 or after 16:00 then start/end is 16:00-09:00). If you post your automation, it might be better to suggest alternatives.

I just think it should be allowed, or have a setting to turn it off, the n if users are aware they can use as they want, and should understand the pros and cons of settings.

As mentioned, this is here to protect users against picking times where the data is not available straight away causing the sensor to pick times in the past when the data becomes available and not turning on. It was introduced due to a number of issues raised. I'd like to see the automation before thinking about introducing a way of ignoring the error.

github-actions[bot] commented 3 weeks ago

This issue has become stale because it has been open for 30 days with no activity. If you still think it's an issue, please respond soon.

github-actions[bot] commented 1 week ago

This issue has been closed because it has been inactive for 14 days since being marked as stale. This is done to help keep on top of active issues. If you still think it's an issue, please respond to this issue