-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rolling Target Doesn't Return If Rates are Not Available #1111
Comments
This is currently by design for the same reason as the normal sensor as it wouldn't necessarily pick the correct times if all of the data isn't available. This means if you look back at when the sensor comes on, you could incorrectly determine it picked the wrong times even though it picked it based on the limited data it had (unfortunately HA doesn't surface historic attributes with historic states). |
That makes sense and happy to accept it as a (current) limitation. It's important for these things to be traceable. Is there a current workaround to use "all rates available" without a complicated service call manipulating start and end times dynamically? Knowing that Agile is probably the most expensive between 4pm and 7pm kinda mitigates this, but it would be nice to be able to search post 4pm rates if they're available. |
If you use the standard target rate sensor set to 16:00-16:00 as recommended in the docs, then this should find the next set of target times as soon as the times are published (assuming they're published near 4pm). You could shift the times a little later to account for rates coming in late (e.g. 17:00-17:00). As for the rolling target rate sensor, you'd need to dynamically shift the look ahead hours down depending on hour many rates are available, as you've already suggested. I'm hoping that HA will make the attribute history available at some point (there's an open what the heck request), where I can then add more flexibility without opening the issues up to people saying something didn't turn on correctly when it did based on the data available at the time. |
I've been working on how to dynamically work out hours to work around this exact issue. Happy to share what I've got to give you a head start... In my automation I add variables:
Then to run the action:
|
Thanks for that! I see it assumes that rates are delivered at 1600 for 2300 the next day? Based on the code at https://prices.fly.dev/api_how_to I think we can make it a little more generic with the following:
gives the number of hours available today and tomorrow, so we can probably knock up a template sensor that represents "number of hours left" with these two without having to hard code 16 and 23 above? |
Ah nice yeah I will explore that suggestion further! thanks! |
Describe the bug
If the look ahead hours value is greater than the rates that are available, no target is set.
This may be by design, although the Rolling Target docs do not have the same disclaimer seen in the normal Target Rate docs:
Reproduction steps
Set look ahead to be 24 hours. Assuming rates are typically received at 4pm on D and cover till 11pm on D+1, this sensor will stop resolving from 11pm on D.
Expected behaviour
I wanted to move from the normal target rate sensor (set to 4pm) to the rolling target rate so that I could get usage windows for times when we have cheaper rates available past 4pm. At the moment, those windows are only generated at 4pm.
Tariff Code
E-1R-AGILE-24-04-03-C
Integration Version
13.2.1
Home Assistant Version
2024.12.0
Fresh Install?
After upgrading
Home Assistant Logs
No errors seen
Confirmation
The text was updated successfully, but these errors were encountered: