Get an insight into your energy and gas consumption with the option to change the tariff prices in the frontend instead of backend.
I switch to a different energy company every year and do not want to change the tariff prices for each entity in the backend every time. In this project the Dutch Smart Meters DSMR is used
It calculates prices in each entity (i have)
- Today
- Yesterday
- Last week
- This week so fa
- Last month
- This month so far
- This year so far
- Last year
In this example energy and gas consumption is used but of course it is possible with all Utility Meter
Mobile:
Browser:
configuration.yaml
utility_meter:
###### DSMR METER READINGS ######
hourly_power_offpeak:
source: sensor.power_consumption_low
cycle: hourly
hourly_power_peak:
source: sensor.power_consumption_normal
cycle: hourly
hourly_gas:
source: sensor.gas_consumption
cycle: hourly
daily_power_offpeak:
source: sensor.power_consumption_low
cycle: daily
daily_power_peak:
source: sensor.power_consumption_normal
cycle: daily
daily_gas:
source: sensor.gas_consumption
cycle: daily
weekly_power_offpeak:
source: sensor.power_consumption_low
cycle: weekly
weekly_power_peak:
source: sensor.power_consumption_normal
cycle: weekly
weekly_gas:
source: sensor.gas_consumption
cycle: weekly
monthly_power_offpeak:
source: sensor.power_consumption_low
cycle: monthly
monthly_power_peak:
source: sensor.power_consumption_normal
cycle: monthly
monthly_gas:
source: sensor.gas_consumption
cycle: monthly
yearly_power_offpeak:
source: sensor.power_consumption_low
cycle: yearly
yearly_power_peak:
source: sensor.power_consumption_normal
cycle: yearly
yearly_gas:
source: sensor.gas_consumption
cycle: yearly
Check the current energy supplier contract for your prices and change the initial values. The entities in the scripts are in Dutch, sorry for that.
input_number:
# STROOM TARIEVEN
all_in_enkeltarief_stroom:
name: All-in enkeltarief Stroom
initial: 0.213
min: 0.000
max: 0.500
mode: box
step: 0.001
unit_of_measurement: 'EUR per kWh'
vaste_leveringskosten_stroom:
name: Vaste leveringskosten Stroom
initial: 71.39
min: 0.00
max: 100.00
mode: box
step: 0.01
unit_of_measurement: 'EUR per jaar'
vermindering_energiebelasting_stroom:
name: Vermindering Energiebelasting Stroom
initial: -311.62
min: -400.00
max: 0.00
mode: box
step: 0.01
unit_of_measurement: 'EUR per jaar'
netbeheerkosten_stroom:
name: Netbeheerkosten Stroom
initial: 252.40
min: 0.00
max: 400.00
mode: box
step: 0.01
unit_of_measurement: 'EUR per jaar'
# GAS TARIEVEN
all_in_enkeltarief_gas:
name: All-in enkeltarief Gas
initial: 0.725
min: 0.000
max: 0.999
mode: box
step: 0.001
unit_of_measurement: 'EUR per m3'
vaste_leveringskosten_gas:
name: Vaste leveringskosten Gas
initial: 71.39
min: 0.00
max: 100.00
mode: box
step: 0.01
unit_of_measurement: 'EUR per jaar'
netbeheerkosten_gas:
name: Netbeheerkosten Gas
initial: 191.19
min: 0.00
max: 300.00
mode: box
step: 0.01
unit_of_measurement: 'EUR per jaar'
sensor:
# SLIMME METER #
- platform: dsmr
port: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AK3EMMXY-if00-port0
dsmr_version: 5
- platform: template
sensors:
# DSMR METER READINGS #
# CALCULATION TARIF LOW + NORMAL
hourly_power:
friendly_name: Hourly Power
unit_of_measurement: kWh
value_template: "{{ states('sensor.hourly_power_offpeak')|float + states('sensor.hourly_power_peak')|float }}"
daily_power:
friendly_name: Daily Power
unit_of_measurement: kWh
value_template: "{{ states('sensor.daily_power_offpeak')|float + states('sensor.daily_power_peak')|float }}"
weekly_power:
friendly_name: Weekly Power
unit_of_measurement: kWh
value_template: "{{ states('sensor.weekly_power_offpeak')|float + states('sensor.weekly_power_peak')|float }}"
monthly_power:
friendly_name: Monthly Power
unit_of_measurement: kWh
value_template: "{{ states('sensor.monthly_power_offpeak')|float + states('sensor.monthly_power_peak')|float }}"
yearly_power:
friendly_name: Yearly Power
unit_of_measurement: kWh
value_template: "{{ states('sensor.yearly_power_offpeak')|float + states('sensor.yearly_power_peak')|float }}"
# LAST PERIODS GAS
yesterday_gas:
friendly_name: Yesterday Gas
unit_of_measurement: m3
value_template: "{{ state_attr('sensor.daily_gas','last_period') }}"
last_week_gas:
friendly_name: last Week Gas
unit_of_measurement: m3
value_template: "{{ state_attr('sensor.weekly_gas','last_period') }}"
last_month_gas:
friendly_name: last Month Gas
unit_of_measurement: m3
value_template: "{{ state_attr('sensor.monthly_gas','last_period') }}"
last_year_gas:
friendly_name: last Year Gas
unit_of_measurement: m3
value_template: "{{ state_attr('sensor.yearly_gas','last_period') }}"
# LAST PERIODS POWER
yesterday_power:
friendly_name: Yesterday Power
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.daily_power_offpeak','last_period')|float + state_attr('sensor.daily_power_peak','last_period')|float }}"
last_week_power:
friendly_name: Last Week Power
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.weekly_power_offpeak','last_period')|float + state_attr('sensor.weekly_power_peak','last_period')|float }}"
last_month_power:
friendly_name: Last Month Power
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.monthly_power_offpeak','last_period')|float + state_attr('sensor.monthly_power_peak','last_period')|float }}"
last_year_power:
friendly_name: Last Year Power
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.yearly_power_offpeak','last_period')|float + state_attr('sensor.yearly_power_peak','last_period')|float }}"
# SHORT POWER
daily_power_short:
value_template: "{{ '%.3f'%(states('sensor.daily_power') | float) | float }}"
unit_of_measurement: 'kWh'
yesterday_power_short:
value_template: "{{ '%.3f'%(states('sensor.yesterday_power') | float) | float }}"
unit_of_measurement: 'kWh'
weekly_power_short:
value_template: "{{ '%.3f'%(states('sensor.weekly_power') | float) | float }}"
unit_of_measurement: 'kWh'
last_week_power_short:
value_template: "{{ '%.3f'%(states('sensor.last_week_power') | float) | float }}"
unit_of_measurement: 'kWh'
monthly_power_short:
value_template: "{{ '%.3f'%(states('sensor.monthly_power') | float) | float }}"
unit_of_measurement: 'kWh'
last_month_power_short:
value_template: "{{ '%.3f'%(states('sensor.last_month_power') | float) | float }}"
unit_of_measurement: 'kWh'
yearly_power_short:
value_template: "{{ '%.3f'%(states('sensor.yearly_power') | float) | float }}"
unit_of_measurement: 'kWh'
last_year_power_short:
value_template: "{{ '%.3f'%(states('sensor.last_year_power') | float) | float }}"
unit_of_measurement: 'kWh'
# CACULATIONS
power_kwh_to_watt:
friendly_name: 'Actueel Watt'
unit_of_measurement: 'Watt'
value_template: "{{ (states.sensor.power_consumption.state | float * 1000) | round(0) }}"
#Gemiddeld
average_gas_day:
unit_of_measurement: 'm3'
value_template: >-
{% set a = states('sensor.last_month_gas') | float %}
{{ (a / 30.41) | round(3) }}
#Gemiddeld
average_power_day:
unit_of_measurement: 'kWh'
value_template: >-
{% set a = states('sensor.last_month_power') | float %}
{{ (a / 30.41) | round(3) }}
# INNOVA ENERGIE
# PRICES GAS
today_gas_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.daily_gas') | float %}
{% set b = states('input_number.all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.netbeheerkosten_gas') | float / 365 %}
{% set d = states('input_number.vaste_leveringskosten_gas') | float / 365 %}
{{ (((a * b) + c) + d) | round(2) }}
yesterday_gas_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.yesterday_gas') | float %}
{% set b = states('input_number.all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.netbeheerkosten_gas') | float / 365 %}
{% set d = states('input_number.vaste_leveringskosten_gas') | float / 365 %}
{{ (((a * b) + c) + d) | round(2) }}
week_gas_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.weekly_gas') | float %}
{% set b = states('input_number.all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.netbeheerkosten_gas') | float / 52 %}
{% set d = states('input_number.vaste_leveringskosten_gas') | float / 52 %}
{{ (((a * b) + c) + d) | round(2) }}
last_week_gas_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_week_gas') | float %}
{% set b = states('input_number.all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.netbeheerkosten_gas') | float / 52 %}
{% set d = states('input_number.vaste_leveringskosten_gas') | float / 52 %}
{{ (((a * b) + c) + d) | round(2) }}
month_gas_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.monthly_gas') | float %}
{% set b = states('input_number.all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.netbeheerkosten_gas') | float / 12 %}
{% set d = states('input_number.vaste_leveringskosten_gas') | float / 12 %}
{{ (((a * b) + c) + d) | round(2) }}
last_month_gas_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_month_gas') | float %}
{% set b = states('input_number.all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.netbeheerkosten_gas') | float / 12 %}
{% set d = states('input_number.vaste_leveringskosten_gas') | float / 12 %}
{{ (((a * b) + c) + d) | round(2) }}
year_gas_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.yearly_gas') | float %}
{% set b = states('input_number.all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.netbeheerkosten_gas') | float %}
{% set d = states('input_number.vaste_leveringskosten_gas') | float %}
{{ (((a * b) + c) + d) | round(2) }}
last_year_gas_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_year_gas') | float %}
{% set b = states('input_number.all_in_enkeltarief_gas') | float %}
{% set c = states('input_number.netbeheerkosten_gas') | float %}
{% set d = states('input_number.vaste_leveringskosten_gas') | float %}
{{ (((a * b) + c) + d) | round(2) }}
# PRICES POWER
today_power_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.daily_power') | float %}
{% set b = states('input_number.all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.netbeheerkosten_stroom') | float / 365 %}
{% set d = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
{% set e = states('input_number.vermindering_energiebelasting_stroom') | float / 365 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
yesterday_power_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.yesterday_power') | float %}
{% set b = states('input_number.all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.netbeheerkosten_stroom') | float / 365 %}
{% set d = states('input_number.vaste_leveringskosten_stroom') | float / 365 %}
{% set e = states('input_number.vermindering_energiebelasting_stroom') | float / 365 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
week_power_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.weekly_power') | float %}
{% set b = states('input_number.all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.netbeheerkosten_stroom') | float / 52 %}
{% set d = states('input_number.vaste_leveringskosten_stroom') | float / 52 %}
{% set e = states('input_number.vermindering_energiebelasting_stroom') | float / 52 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
last_week_power_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_week_power') | float %}
{% set b = states('input_number.all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.netbeheerkosten_stroom') | float / 52 %}
{% set d = states('input_number.vaste_leveringskosten_stroom') | float / 52 %}
{% set e = states('input_number.vermindering_energiebelasting_stroom') | float / 52 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
month_power_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.monthly_power') | float %}
{% set b = states('input_number.all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.netbeheerkosten_stroom') | float / 12 %}
{% set d = states('input_number.vaste_leveringskosten_stroom') | float / 12 %}
{% set e = states('input_number.vermindering_energiebelasting_stroom') | float / 12 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
last_month_power_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_month_power') | float %}
{% set b = states('input_number.all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.netbeheerkosten_stroom') | float / 12 %}
{% set d = states('input_number.vaste_leveringskosten_stroom') | float / 12 %}
{% set e = states('input_number.vermindering_energiebelasting_stroom') | float / 12 %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
year_power_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.yearly_power') | float %}
{% set b = states('input_number.all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.netbeheerkosten_stroom') | float %}
{% set d = states('input_number.vaste_leveringskosten_stroom') | float %}
{% set e = states('input_number.vermindering_energiebelasting_stroom') | float %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
last_year_power_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_year_power') | float %}
{% set b = states('input_number.all_in_enkeltarief_stroom') | float %}
{% set c = states('input_number.netbeheerkosten_stroom') | float %}
{% set d = states('input_number.vaste_leveringskosten_stroom') | float %}
{% set e = states('input_number.vermindering_energiebelasting_stroom') | float %}
{{ ((((a * b) + c) + d) + e) | round(2) }}
ui-lovelace:
###### PAGE - STATISTICS ######
- title: STATISTICS
icon: mdi:chart-line
panel: false
path: statistics
badges: []
cards:
- type: horizontal-stack
cards:
- type: vertical-stack
cards:
#LINKS ELEKTRA
- type: 'custom:vertical-stack-in-card'
title: Elektra
cards:
- type: custom:gauge-card
title: null
entity: sensor.power_kwh_to_watt
min: 0
max: 5000
scale: 37px
severity:
green: 0
yellow: 500
amber: 5000
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.average_power_day
name: Gemiddeld
icon: mdi:home-analytics
- entity: sensor.daily_power_short
name: Vandaag
icon: 'mdi:flash'
- entity: sensor.today_power_price
name: Vandaag
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.yesterday_power_short
name: Gisteren
icon: 'mdi:flash'
- entity: sensor.yesterday_power_price
name: Gisteren
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.weekly_power_short
name: Deze Week
icon: 'mdi:flash'
- entity: sensor.week_power_price
name: Deze Week
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.last_week_power_short
name: Vorige Week
icon: 'mdi:flash'
- entity: sensor.last_week_power_price
name: Vorige Week
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.monthly_power_short
name: Deze Maand
icon: 'mdi:flash'
- entity: sensor.month_power_price
name: Deze Maand
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.last_month_power_short
name: Vorige Maand
icon: 'mdi:flash'
- entity: sensor.last_month_power_price
name: Vorige Maand
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.yearly_power_short
name: Dit Jaar
icon: 'mdi:flash'
- entity: sensor.year_power_price
name: Dit Jaar
icon: 'mdi:currency-eur'
# - type: entities
# title: null
# show_header_toggle: false
# entities:
# - entity: sensor.last_year_power_short
# name: Vorig Jaar
# icon: 'mdi:power-plug'
# - entity: sensor.last_year_power_price
# name: Vorig Jaar
# icon: 'mdi:currency-eur'
#RECHTS GAS
- type: vertical-stack
cards:
- type: 'custom:vertical-stack-in-card'
title: Gas
cards:
- type: custom:mini-graph-card
entities:
- entity: sensor.hourly_gas_consumption
name: false
hour24: true
align_state: center
line_width: 2
font_size: 100
hours_to_show: 24
points_per_hour: 0.99
animate: true
show:
graph: bar
name: false
icon: false
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.average_gas_day
name: Gemiddeld
icon: mdi:home-analytics
- entity: sensor.daily_gas
name: Vandaag
icon: 'mdi:fire'
- entity: sensor.today_gas_price
name: Vandaag
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.yesterday_gas
name: Gisteren
icon: 'mdi:fire'
- entity: sensor.yesterday_gas_price
name: Gisteren
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.weekly_gas
name: Deze Week
icon: 'mdi:fire'
- entity: sensor.week_gas_price
name: Deze Week
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.last_week_gas
name: Vorige Week
icon: 'mdi:fire'
- entity: sensor.last_week_gas_price
name: Vorige Week
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.monthly_gas
name: Deze Maand
icon: 'mdi:fire'
- entity: sensor.month_gas_price
name: Deze Maand
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.last_month_gas
name: Vorige Maand
icon: 'mdi:fire'
- entity: sensor.last_month_gas_price
name: Vorige Maand
icon: 'mdi:currency-eur'
- type: entities
title: null
show_header_toggle: false
entities:
- entity: sensor.yearly_gas
name: Dit Jaar
icon: 'mdi:fire'
- entity: sensor.year_gas_price
name: Dit Jaar
icon: 'mdi:currency-eur'
# - type: entities
# title: null
# show_header_toggle: false
# entities:
# - entity: sensor.last_year_gas
# name: Vorig Jaar
# icon: 'mdi:fire'
# - entity: sensor.last_year_gas_price
# name: Vorig Jaar
# icon: 'mdi:currency-eur'
- type: horizontal-stack
cards:
- type: vertical-stack
cards:
# TARIEVEN
- type: entities
title: Tarieven
show_header_toggle: false
entities:
- entity: input_number.all_in_enkeltarief_stroom
name: Tarief per kWh
icon: 'mdi:flash'
- entity: input_number.netbeheerkosten_stroom
name: Vaste netbeheerkosten per jaar
icon: 'mdi:flash'
- entity: input_number.vaste_leveringskosten_stroom
name: Vaste leveringskosten per jaar
icon: 'mdi:flash'
- entity: input_number.vermindering_energiebelasting_stroom
name: Vermindering energiebelasting per jaar
icon: 'mdi:flash'
- entity: input_number.all_in_enkeltarief_gas
name: Tarief per m3
icon: 'mdi:fire'
- entity: input_number.vaste_leveringskosten_gas
name: Vaste leveringskosten per jaar
icon: 'mdi:fire'
- entity: input_number.netbeheerkosten_gas
name: Netbeheerkosten per jaar
icon: 'mdi:fire'