Skip to content

Commit

Permalink
Fix for split mode (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFes authored Feb 26, 2024
1 parent 21666f2 commit 215060c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cheapest_energy_hours.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,20 @@
{%- set split.datapoints = 1 -%}
{%- set price = values[loop.index0][value_key] if pt == 0 else values[loop.index0].original_value %}
{%- set split.prices = [price | round(pr)] -%}
{%- if loop.last -%}
{%- set is_now = split.start <= now() < dt + timedelta(hours=1/dph) -%}
{%- set prices = split.prices -%}
{%- set split.split = split.split + [
dict(
start=_format_date(split.start, time_format),
end=_format_date(dt + timedelta(hours=1/dph), time_format),
hours=(split.datapoints/dph)|round(2),
prices=prices,
is_now=is_now
)
]
-%}
{%- endif -%}
{%- else -%}
{%- set split.start = split.start | default(dt, true) -%}
{%- set split.datapoints = split.datapoints + 1 -%}
Expand Down

0 comments on commit 215060c

Please sign in to comment.