Poland, Tauron #209
KrzysztofHajdamowicz
started this conversation in
Price Modifyer Templates
Replies: 1 comment
-
|
I believe, that according to G12W tariff, the above code should also consider bank holidays in Poland regardless current week day, when You've also mentioned that:
Can you provide an exact URL where this current data can be scraped online, instead of hardcoding? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
uses: 0,36898 PLN/kWh as peak and 0,09028 PLN/kWh off-peak during 2024H2)
{% set s = { "exchange_rate": states('sensor.eur_to_pln_exchange_rate')|float, "VAT": 1.23, "peak_distribution_rate": states('input_number.dystrybucja_g12w_szczyt')|float, "offpeak_distribution_rate": states('input_number.dystrybucja_g12w_pozaszczyt')|float, "market_access_fee": states('input_number.tauron_taryfa_dynamiczna_prowizja')|float } %} {# Define peak periods for G12W tariff as a list of tuples (start_hour, stop_hour) #} {% set peaks = [(6, 13), (15, 22)] %} {# Determine if it's a weekend (offpeak all day) #} {% set is_weekend = now().weekday() >= 5 %} {# Check if the current time falls within any peak period #} {% set is_peak = False %} {% if not is_weekend %} {% for peak in peaks %} {% if now().hour >= peak[0] and now().hour < peak[1] %} {% set is_peak = True %} {% endif %} {% endfor %} {% endif %} {# Set distribution rate based on peak or offpeak time #} {% set distribution_rate = s.peak_distribution_rate if is_peak else s.offpeak_distribution_rate %} {# Final price calculation: convert current_price to PLN, add distribution rate, market access fee, and apply VAT #} {{ ((current_price * s.exchange_rate) + distribution_rate + s.market_access_fee) * s.VAT | float }}Beta Was this translation helpful? Give feedback.
All reactions