Jeg har laget en template som inkluderer både nettleie (dag/natt/helligdag) og strømstøtte, også for morgendagen, slik at man får ut effektiv reell kostnad for strømmen.
Slik ser den ut:
{# January to March - Weekend and holiday taxes #}
{% if (as_timestamp(now()) | timestamp_custom("%F")) in (state_attr('calendar.holidays','holidays') | list) and (now().month >= 1 and now().month <= 3) %}
{% set el_taxes = 0.3558 %}
{# April to December - Weekend and holiday taxes #}
{% elif (as_timestamp(now()) | timestamp_custom("%F")) in (state_attr('calendar.holidays','holidays') | list) and (now().month >= 4) %}
{% set el_taxes = 0.4393 %}
{# January to March - Dyatime taxes #}
{% elif (now().month >= 1 and now().month <= 3) and (now().hour >= 6 and now().hour <= 22) %}
{% set el_taxes = 0.4738 %}
{# January to March - Night taxes #}
{% elif (now().month >= 1 and now().month <= 3) and (now().hour >= 23 or now().hour <= 5) %}
{% set el_taxes = 0.3558 %}
{# April to December - Day taxes #}
{% elif (now().month >= 4) and (now().hour >= 6 and now().hour <= 22) %}
{% set el_taxes = 0.5573 %}
{# April to December - Night taxes #}
{% elif (now().month >= 4) and (now().hour >= 23 or now().hour <= 5) %}
{% set el_taxes = 0.4393 %}
{% endif %}
{# Calculate the subsidies and add the taxes #}
{% if current_price > 0.875 %}
{% set subs = (current_price - 0.875) * 0.9 %}
{% set additional_cost = el_taxes - subs %}
{% elif current_price <= 0.875 %}
{% set additional_cost = el_taxes %}
{% endif %}
{{ additional_cost | round(4) }}
Bare enkelt testet hos meg, men kanskje andre har brukt for ideen?