hass.tibber_prices/custom_components/tibber_prices/services
anthropic-code-agent[bot] 691e917c0a
fix(services): ceil search_start to next quarter when include_current_interval=false
When include_current_interval=False, the search_start was set to the raw
now timestamp (e.g. 14:47:00.167996). The interval pool index iterates in
15-minute steps from that exact value, so keys like 14:47:00, 15:02:00, …
never matched any cached interval (which are always on :00/:15/:30/:45
boundaries), causing no data to be found and returning no_data_in_range.

Fix: replace `now` with `ceil_to_next_quarter_hour(now)` which is always
`floor(now) + 15min`. This skips the interval that is currently in progress
(14:30–14:45 interval) and starts at the first interval that hasn't begun
yet (15:00), consistent with the intent of include_current_interval=False.

Fixes #190

User-Impact: find_cheapest_block/find_most_expensive_block/find_cheapest_hours
with include_current_interval=false and search_scope=next_24h (or no scope)
no longer returns no_data_in_range when data is available.

Agent-Logs-Url: https://github.com/jpawlowski/hass.tibber_prices/sessions/0ea804f9-7c98-4e5a-b40f-469954fa9daa

Co-authored-by: jpawlowski <75446+jpawlowski@users.noreply.github.com>
2026-07-27 16:14:20 +00:00
..
charging fix(services): prevent plan_charging overcharge from segment-constraint bridging 2026-07-04 17:43:04 +00:00
__init__.py feat(services): add plan_charging service for battery/EV scheduling 2026-04-20 21:43:41 +00:00
debug_clear_tomorrow.py fix(services): use injected now in resolve_search_range day offset 2026-04-14 19:33:24 +00:00
entity_resolver.py feat(services): allow entity IDs as service parameter values 2026-04-20 18:44:24 +00:00
find_cheapest_block.py fix(services): prevent power_profile truncation during relaxation 2026-07-04 18:22:44 +00:00
find_cheapest_hours.py fix(services): prevent power_profile truncation during relaxation 2026-07-04 18:22:44 +00:00
find_cheapest_schedule.py fix(services): prevent power_profile truncation during relaxation 2026-07-04 18:22:44 +00:00
find_most_expensive_block.py feat(services): add 5 scheduling services for price-optimized time windows 2026-04-11 18:58:27 +00:00
find_most_expensive_hours.py feat(services): add 5 scheduling services for price-optimized time windows 2026-04-11 18:58:27 +00:00
formatters.py fix(services): use injected now in resolve_search_range day offset 2026-04-14 19:33:24 +00:00
get_apexcharts_yaml.py feat(services): add price_source parameter to get_chartdata and get_apexcharts_yaml 2026-05-03 18:48:36 +00:00
get_chartdata.py fix(get_chartdata): use proper statistics.median for chart metadata 2026-07-04 18:23:25 +00:00
get_price.py feat(services): isolate price-fetch failures and add success flag to responses 2026-05-30 14:46:23 +00:00
helpers.py fix(services): ceil search_start to next quarter when include_current_interval=false 2026-07-27 16:14:20 +00:00
plan_charging.py fix(services): prevent plan_charging overcharge from segment-constraint bridging 2026-07-04 17:43:04 +00:00
refresh_user_data.py feat(services): add 5 scheduling services for price-optimized time windows 2026-04-11 18:58:27 +00:00
relaxation.py feat(pricing): add relaxation logic for progressive filter loosening 2026-04-18 21:27:05 +00:00