A guide to setup Home Assistant Energy Dashboard to show electricity purchase based on Tariff 3.0
The purpose of the template sensor is just to give a value "lavlast", "hojlast" or "spidslast" based on the time of day.
Make sure to place the code in your templates section and make the appropriate indentation.
- sensor:
# Lavlast (00-06)
# Højlast (06-17) & (21-00)
# Spidslast (17-21)
- name: "Tariff 3.0"
unique_id: 541d7af3-7518-42b4-ad78-7fba858c7770
state: "{{ 'spidslast' if today_at('17:00') < now() < today_at('21:00') else ('lavlast' if today_at('00:00') < now() < today_at('06:00') else 'hojlast') }}"
Creating this Utility Helper will provide a “base” sensor (which controls which tariff is currently in use), and one sensor for each tariff (which counts the amount of energy used on each tariff)
Make sure to choose the correct sensor from your power-meter or similiar (in this example "Energy Imported" from a Slimmelezer connected to Landis+Gyr Electricity meter), the name will probably differ from this example
Make sure to type in the helper name and the three tariff names exactly.
The purpose of this automation is to update the utility helper created in step 2, to the current tariff when the tariff changes
After creating the automation, run it manually the first time, to syncronize the Utility helper with the current tariff
alias: Set Electricity Tariff
description: ""
trigger:
- platform: state
entity_id: sensor.tariff_3_0
not_to:
- unavailable
- unknown
action:
- service: select.select_option
target:
entity_id: select.tariff_3_0_import
data:
option: "{{ trigger.to_state.state if 'to_state' in trigger else 'hojlast' }}"
mode: single
Do this for all 3 tariffs
I recommend using EnergiDataService for the price information on the sensors
And then you get the information presented in your Energy Dashboard like this:
You can also make a pie chart showing the import distribution across tarrifs:
type: custom:apexcharts-card
chart_type: pie
apex_config:
legend:
show: false
dataLabels:
enabled: true
dropShadow:
enabled: true
formatter: |
EVAL:function(value) {
return Number.parseFloat(Number(value)).toFixed(1) + "%";
}
header:
show: true
show_states: true
colorize_states: true
title: Energy import tariff distribution
all_series_config:
show:
legend_value: false
datalabels: percent
in_header: raw
float_precision: 2
series:
- entity: sensor.tariff_3_0_import_lavlast
name: Lavlast
- entity: sensor.tariff_3_0_import_hojlast
name: Højlast
- entity: sensor.tariff_3_0_import_spidslast
name: Spidslast