Home Assistant- Tariff Logging

Stage-1: Create Two Time Selectors

Create two time helpers to store/set the start and end times of the Tariff, for example Off-Peak start and Peak Start times.

Go to Settings > Devices & Services > Helpers then click on “Create Helper”.

Give it a name of “Off-Peak Energy Start” (note the exact spelling it’s important!). Select the ‘Time’ radio box as this helper only stores a time (not a date, or date and time).

Repeat the process for the Off-Peak end name it  “Off-Peak Energy End”.

Edit your chosen dashboard and add the two helpers to it, perhaps add an ‘Tariff’ card, so the values can be set to match your energy tariff hours. For example, if you’re on E.ON Next Drive then the Start time will be 00:00 and the End time to 07:00

Stage-2: Create a Utility Meter

Now create a utility meter that will use the Tariff start and End times to calculate your energy usage.

Go to Settings > Devices & Services > Helpers then click on the “Create Helper” button, then scroll down to the bottom of the list and choose “Utility Meter”.

Name it “Energy – Grid Import” (note the name!) and in the sensor field you should select the energy sensor entity that is tracking your grid import energy. e.g. Grid Import, but it must be an Energy sensor, not for example in k Watts.

Choose a cycle time period of ‘daily’, which will ensure the sensor is reset to zero at midnight every day and will only ever store the total consumed energy for the current day.

Now take a look at the ‘supported tariffs’ field and type in, without the quotes “peak” then enter it, next enter “offpeak” and enter to add it. Note the spelling of both of those words – they need to match exactly as written here because they’ll be referenced later on. Scroll down to the submit button to save.

Step 3: Automation

Now add an automation that will switch the utility meter between the peak and off-peak tariffs based on the times set in the time helpers.

Go to Settings > Automations & Scenes, click on “Create Automation” and choose the option to “Start with an empty automation”. Click on the three dots in the top-right hand corner to expand the options menu and choose “Edit YAML”. Now enter this:

alias: "Energy: Peak and Offpeak Tariffs"
description: ""
trigger:
  - platform: time
    at: input_datetime.off_peak_energy_end
    variables:
      tariff: peak
  - platform: time
    at: input_datetime.off_peak_energy_start
    variables:
      tariff: offpeak
action:
  - service: select.select_option
    target:
      entity_id: select.energy_grid_import
    data:
      option: "{{ tariff }}"
mode: single

Step 4: Energy Dashboard Configuration

Now  add the split-tariff utility meter to the energy dashboard so the graphs will update.

Go to to Settings > Dashboards, then click on ‘Energy’ in the list. In the ‘Electricity grid’ section, click on ‘Add Consumption’. Select “Energy – Grid Import peak” in the Consumed Energy drop-down.

Now you can configure the energy tariff rates by selecting the ‘Use a static price’ and typing in your peak rate price.

Click on save once you’re done, and then repeat the process but adding “Energy – Grid Import offpeak”. Next enter or amend your off-peak price.

There is typically a two hour wait for the data to start updating, but eventually the graphs will be populated in the Energy Dashboard itself