Skip to content

Commit

Permalink
Prevent zero division due to DST change
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFes committed Oct 27, 2024
1 parent a7c184e commit d3ed9d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cheapest_energy_hours.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
{%- endfor -%}
{%- set data = rebuild.data | sort(attribute='time') -%}
{%- endif -%}
{%- set dph = int(3600 / (data[1][time_key] - data[0][time_key]).total_seconds()) if data | count > 1 else 1 -%}
{%- set dph = int(3600 / (data[1][time_key] - data[0][time_key]).total_seconds() | default(1, true)) if data | count > 1 else 1 -%}
{#- set weight points based on energy plot sensor -#}
{%-if program is not none-%}
{%- set plot_data = state_attr(plot_sensor, plot_attr) | default({}, true) -%}
Expand Down

0 comments on commit d3ed9d8

Please sign in to comment.