Power Tarrif configuration by season and time

Dear all,
I am a silent follower of this great project. In the last 3 weeks I decided to move on HA my hole house automation and I’m on the begin of learning curve.
I try to establish 2 tarrifs for energy usage. The provider here in Greece has 2 tarrifs zones that depend from season and from time, like the following

Winter season:
1/11-30/4 : low tarrif between 2:00-8:00 and 15:00-17:00
summer season:
1/5-31/10: low tarrif between 23:00 - 7:00

Does anyone has a similar case to share with me?

Here is a modified example I did for someone else. This should hit all the tariffs.

#--------------------------------------------------------------------------------------------------
# For peak demand pricing
#--------------------------------------------------------------------------------------------------
template:
  - name: "Energy Price"
    unique_id: "energy_price"
    state: >-
      {% set hr = now().hour %}
      {% if (now().month in [5,6,7,8,9,10]) %}  <---- Summer
        {% if (7 <= hr < 23 )  %}
          0.22  <--- high tariff
        {% else %}
          0.15
        {% endif %}
      {% else %} 
        {% if ( 2 <= hr < 8 ) or ( 15 <= hr < 17 ) %}
          0.15 <---- low tariff
        {% else %}
          0.22
        {% endif %}
      {% endif %} 
    unit_of_measurement: "USD/kWh"

You will obviously need to remove the text descriptions and change the units. The sensor will be sensor.energy_price.

Edit - fixed array as discussed below

Isn’t [5,10] an array with just “may” and “October”?
Shouldn’t that be [5,6,7,8,9,10]?

see here

both will work.

So in your template tool does this return true?

{{ 6 in [5,10] }}

Thank you for your support. I have an another issue how to measure the KWh per zone as they get also other fees for CO2 emissions and tax. I feel I need to change a bit the given template or do something total different?

It does not. I learned something today. Thanks. Will fix in my example.

@korniza

have an another issue how to measure the KWh per zone as they get also other fees for CO2 emissions and tax.

I don’t follow what you mean by zone? Also isn’t the CO2 charge on a per kwh basis? Also note that Hellis81 is correct and the list must contain all months.

I like to count the KWh on Peak and to offpeak daily/monthly/yearly.