Energy Dual Tariff Cost

Background:
With my utility supplier in the UK (Utilita Energy), I have two tariff prices which depend on how much electricity I have used.

Quote below from my supplier shows for the first 2kWh of energy used, I’ll be on the high tariff.
After the 2kWh is used, It moves over to the lower Tariff

All Periods - First 2 kWh each Day at 35.21p per kWh, thereafter at 19.73p. Standing Charge is £0. Prices are inclusive of Vat at 5%


Requirements:
Firstly, you’ll need a sensor pulling the Energy/Grid Consumption
I use the Efergy integration which gives me sensor.daily_consumption sensor


I have three Helpers which can be created in the Home Assistant Interface
Input Number x1 - To set the kWh for the ‘High Value’

input_number.utilitatariff_dailykwh

Input Text x2 - To set the cost of each Tariff

input_text.utilitatariffrate1

input_text.utilitatariffrate2


The next step is to add a Template Sensor
This template checks the current usage vs the input_number.utilitatariff_dailykwh.
If the Current Usage is greater, it’ll use the second Tariff.

- platform: template
  sensors:
    utilita_electric_actual_daily_cost:
       friendly_name: "Utilita Elec Daily Cost"
       unit_of_measurement: '£/kWh'
       icon_template: mdi:flash
       value_template: >-
               {% if states('sensor.daily_consumption') | float > states('input_number.utilitatariff_dailykwh') | float %}
                {{ states("input_text.utilitatariffrate2") | round(3) }}
                {% else %}
                {{ states("input_text.utilitatariffrate1") | round(3) }}
                {%- endif %}

Now you should be left with something like this…

UtilitaTariff_DailykWh = How many kWh until it goes to the second Tariff
UtilitaTariffRate1 = Price of Tariff #1
UtilitaTariffRate2 = Price of Tariff #2
Utilita Elec Daily Cost = This will show the current Tariff rate and can be used to track the price

image


Final Step - Configure the Grid Consumption to use the Utilita Elec Daily Cost

2 Likes

Hi, thank you for this explanation it’s helped me a lot.

actually in my country there are 3 tariffs, the first tariff from 0-100KWh, the second tariff from 101-160KWh, and the third tariff which is last its start from 161.

So, I should add one more helper for the third tariff, and in the template

- platform: template
 sensors:
   utilita_electric_actual_daily_cost:
      friendly_name: "Utilita Elec Daily Cost"
      unit_of_measurement: '£/kWh'
      icon_template: mdi:flash
      value_template: >-
              {% if states('sensor.daily_consumption') | float > states('input_number.utilitatariff_dailykwh') | float %} 
               {{ states("input_text.utilitatariffrate3") | round(3) }}
               {% else %}
               {{ states("input_text.utilitatariffrate2") | round(3) }}
               {% else %}
               {{ states("input_text.utilitatariffrate1") | round(3) }}
               {%- endif %}

You would need an "Else If’ or “elif”

A good example here

I need help to create template for my monthly bill tariffs here in Malaysia. It looks similar with yours but the tariff rate will increase base on total of kWh usage per month.

For the first 200 kWh (1 - 200 kWh) per month = MYR0.218/kWh

For the next 100 kWh (201 - 300 kWh) per month = MYR0.334/kWh

For the next 300 kWh (301 - 600 kWh) per month = MYR0.516/kWh

For the next 300 kWh (601 - 900 kWh) per month = MYR0.546/kWh

For the next kWh (901 kWh onwards) per month = MYR0.571/kWh

How do i do this…

I think you need to define a utility meter, with multiple tariffs (tariff1 for first slab 200 kWh, tariff2 for second slab 201-300kWh, and so on). So you will end up with multiple utility meters, one per each tariff.
It will also create some “select” entity that defines which tariff applies to that utility meter at that moment.

Then, you need to create some automation that checks the current meter reading against the utility meter consumption. This automation should update the select entity to the correct tariff.
So your initial consumption should accumulate to the first tariff, then once you pass the first slab, will accumulate to the second tariff, and so on.
At end of the defined cycle for your utility meter, it will reset all values to 0 and also the select entity will default to first tariff, starting all over again.