Utility meter for different tariffs... during different times of year?

Hello fellow tinkerers

I am using a Emporia Vue 3 to measure the power consumption at our main DB. From there, two commercial buildings and a private house are connected and measured. All working fine.
I would like to analyse the costs and recreate an “invoice” similar to the one from the power supplier but with a differentation of calculating the costs for each building.
Now tariffs are coming in, which should not be a problem using the utility meter helper.
Since I am in South Africa, our power supplier Eskom is not only using daily tariffs (on-/offpeak times) which repeat themselves weekly, but different tariffs by seasons. Two months in winter called high demand season are different from the rest of the year. I will have to use two schedules for high and low demand season.
That is where I am stuck. I thought of using an automation which activate the seasons, but I am not aware of any option to switch helpers on or off.

Is there any option with the utility meter which I missed? Can a helper be activated by an automation?

So you have four tariffs, off peak, peak, off peak high demand and peak high demand.

Switch them with an automation directly using template triggers or use the state of a template sensor to trigger the automation that switches the tariff. I prefer the latter as I can also display the sensor that shows the current tariff in my dashboard.

Screenshot 2025-03-19 at 22-16-21 Overview – Home Assistant

I only have two tariffs (peak /off peak) but the times change with daylight savings.

If you need help with the template you will need to supply the actual peak / off peak times and high demand dates.

Thank you so much for your quick response.

So you have four tariffs, off peak, peak, off peak high demand and peak high demand.

That is correct. The simplified schedule looks like this:

Low demand season (September - May)

  • Peak 6.00 - 18.00
  • Offpeak 18.00 - 6.00

High demand season (June - August)

  • Peak 6.00 - 18.00
  • Offpeak 18.00 - 6.00

So there are four tariffs changing depending of the time of day and the season.

…use the state of a template sensor to trigger the automation that switches the tariff…

no clue in the zoo… how can an automation switch the utility meter?

Had some time to do this example for you:

Utility meter

utility_meter:  # you will need to adjust this to use your sensor
  energy_from_grid_daily:
    source: sensor.energy_import
    cycle: daily
    tariffs:
      - Peak
      - Offpeak
      - Peak High Demand
      - Offpeak High Demand

Template sensor

template:
  - sensor: 
      - name: Current Tariff
        state: >
          {% if 5 < now().month < 9 %}
            {% if 6 <= now().hour < 18 %}
               Peak High Demand
            {% else %}
               Offpeak High Demand
            {% endif %}
          {% else %}
            {% if 6 <= now().hour < 18 %}
               Peak
            {% else %}
               Offpeak
            {% endif %}

Automation

triggers:
  - trigger: state
    entity_id: sensor.current_tariff
    not_to:
      - unknown
      - unavailable
actions:
  - action: select.select_option
    target:
      entity_id:
        - select.energy_from_grid_daily
      data:
        option: >
          {{ states('sensor.current_tariff') }}

Wow… Tom, you are awesome. Thank you for your time pointing me in the right direction. I did not try it out, but to my understanding it is possible to choose the right tariff with an automation?
However, meanwhile I entered the tariff schedule in the native HA calendar. The automation should then be able to switch to the correct tariff depending of the title/message of the calendar event.

Edit: I don’t understand the monthly timeframe you are giving, for example:

{% if 5 < now().month < 9 %}

Why did you add the 9%?

That is not 9% it is 9 (i.e. less than September). The % is part of the bracket.

There is an explanation if the jinja bracket types here: What's with all the curly brackets? Jinja template delimiters and whitespace control

Thank you, now it all makes sense.