@Alwin_Hummels have you looked here? there is an example how to use two tarifs peak and offpeak add these two together and that will be your daily consumption or/and price
Thanx I’m a little bit further but how to automate it with weekend and holidays. that’s when we have low tarif too here in the Netherlands. Low tariff from 23:00 till 07:00 on weekdays and on weekend and holidays also.
thanks for helping me
Looks nice only I try to integrate it in my HA only I get all error messages
Component error: yearly_power_offpeak - Integration ‘yearly_power_offpeak’ not found.
My DSMR cable is working fine and I can see the results on my lovelace UI.
What am I doing wrong?
the entity names has been changed. look here https://www.home-assistant.io/integrations/utility_meter/
power has changed to energy and low/normal is tarif_1 and tarif_2
Thank for the reply! I get is to work now very very nice for a beginner like me
Only problem is that I get this error with the Gauge en Graph. Is the vertical-stack-in-card removed?
Error see below
Custom element doesn’t exist: vertical-stack-in-card.
type: ‘custom:vertical-stack-in-card’
title: Elektra
cards:
- type: ‘custom:gauge-card’
title: null
entity: sensor.energy_kwh_to_watt
min: 0
max: 5000
scale: 37px
severity:
green: 0
yellow: 500
amber: 5000
Hi Lenz-art,
I just stumbled upon this page as I was looking for getting a lot of (history) information out of my DSMR setup with nice Graphs.
I haven’t had the time to try this all out yet, but I think I know what your issue is. Some custom Graphs have been used here. You need to install them first, before you can use them. I found some information here. I hope this is what you are looking for.
For those who are intrested. I have been using DSMR reader that is made by Dennis Siemensma. I have installed this parallel to home assistant in a separate VM. DSMR reader stores data read and visualizes. The data is forwarded in real time to Home Assistant via MQTT so that I can use this project and DSMR-Reader side by side.
Care to share your setup? Keep running into difficulties with this. Much appreciated
Will do it when I’m ready with my system. I just started over my config because it was a big mesh
Give me a week or maybe two and I post my config.
Please be paitient
Thanks for this nice post!
I use the workday sensor in an automation for switching between tarrifs
- platform: workday
country: NL
workdays: [mon, tue, wed, thu, fri]
excludes: [sat, sun, holiday]
add_holidays:
- '2020-04-10' #Goede vrijdag
- '2020-04-12' #Pasen
- '2020-04-13' #Paasmaandag
- '2020-04-27' #Koningsdag
- '2020-05-05' #Bevrijdingsdag
- '2020-05-21' #O.H. Hemelvaart
- '2020-05-31' #Pinksteren
- '2020-06-01' #Pinkstermaandag
- '2020-12-25' #Kerstmis
- '2020-12-26' #2de Kerstdag
- '2021-01-01' #Nieuwjaarsdag
- '2021-04-02' #Goede vrijdag
- '2021-04-04' #Pasen
- '2021-04-05' #Paasmaandag
- '2021-04-27' #Koningsdag
- '2021-05-05' #Bevrijdingsdag
- '2021-05-13' #O.H. Hemelvaart
- '2021-05-23' #Pinksteren
- '2021-06-24' #Pinkstermaandag
- '2021-12-25' #Kerstmis
- '2021-12-26' #2de Kerstdag
- '2022-01-01' #Nieuwjaarsdag
- '2022-04-15' #Goede vrijdag
- '2022-04-17' #Pasen
- '2022-04-18' #Paasmaandag
- '2022-04-27' #Koningsdag
- '2022-05-05' #Bevrijdingsdag
- '2022-05-26' #O.H. Hemelvaart
- '2022-06-05' #Pinksteren
- '2022-06-06' #Pinkstermaandag
- '2022-12-25' #Kerstmis
- '2022-12-26' #2de Kerstdag
- '2023-01-01' #Nieuwjaarsdag
- '2023-04-07' #Goede vrijdag
- '2023-04-09' #Pasen
- '2023-04-10' #Paasmaandag
- '2023-04-27' #Koningsdag
- '2023-05-05' #Bevrijdingsdag
- '2023-05-18' #O.H. Hemelvaart
- '2023-05-28' #Pinksteren
- '2023-05-29' #Pinkstermaandag
- '2023-12-25' #Kerstmis
- '2023-12-26' #2de Kerstdag
- '2024-01-01' #Nieuwjaarsdag
- '2024-03-29' #Goede vrijdag
- '2024-04-31' #Pasen
- '2024-05-01' #Paasmaandag
- '2024-04-27' #Koningsdag
- '2024-05-05' #Bevrijdingsdag
- '2024-05-09' #O.H. Hemelvaart
- '2024-05-19' #Pinksteren
- '2024-05-20' #Pinkstermaandag
- '2024-12-25' #Kerstmis
- '2024-12-26' #2de Kerstdag
- '2025-01-01' #Nieuwjaarsdag
- '2025-04-18' #Goede vrijdag
- '2025-04-21' #Pasen
- '2025-04-21' #Paasmaandag
- '2025-04-27' #Koningsdag
- '2025-05-05' #Bevrijdingsdag
- '2025-05-29' #O.H. Hemelvaart
- '2025-06-08' #Pinksteren
- '2025-06-09' #Pinkstermaandag
- '2025-12-25' #Kerstmis
- '2025-12-26' #2de Kerstdag
Dont get this. Your DSMR reader should switch automatically from low to high tarif and vice versa, when the low tarif is active de high tarif sensor stop counting. If you combine (peak + offpeak) in a template sensor you always have your total. The physical peak of peak aka high low tarif switch in your meter is managed by your provider. So no need to exclude weekends and holidays
You are right thanks for your explanation
exactly, difficulty I am facing is that there seems to be something wrong in calculations. Average is always zero and some numbers/ amounts are negative? any tips?
Please share your config so we can have a look. Btw nice layout!
Thanks Buddy
groups:
meter_readings:
name: Meter readings
entities:
- sensor.energy_consumption_tarif_1
- sensor.energy_consumption_tarif_2
- sensor.energy_production_tarif_1
- sensor.energy_production_tarif_2
- sensor.gas_consumption
utilitymeter:
utility_meter: ###### DSMR METER READINGS ######
hourly_energy_offpeak:
source: sensor.energy_consumption_tarif_1
cycle: hourly
hourly_energy_peak:
source: sensor.energy_consumption_tarif_2
cycle: hourly
hourly_gas:
source: sensor.gas_consumption
cycle: hourly
daily_energy_offpeak:
source: sensor.energy_consumption_tarif_1
cycle: daily
daily_energy_peak:
source: sensor.energy_consumption_tarif_2
cycle: daily
daily_gas:
source: sensor.gas_consumption
cycle: daily
weekly_energy_offpeak:
source: sensor.energy_consumption_tarif_1
cycle: weekly
weekly_energy_peak:
source: sensor.energy_consumption_tarif_2
cycle: weekly
weekly_gas:
source: sensor.gas_consumption
cycle: weekly
monthly_energy_offpeak:
source: sensor.energy_consumption_tarif_1
cycle: monthly
monthly_energy_peak:
source: sensor.energy_consumption_tarif_2
cycle: monthly
monthly_gas:
source: sensor.gas_consumption
cycle: monthly
yearly_energy_offpeak:
source: sensor.energy_consumption_tarif_1
cycle: yearly
yearly_energy_peak:
source: sensor.energy_consumption_tarif_2
cycle: yearly
yearly_gas:
source: sensor.gas_consumption
cycle: yearly
sensor:
# SLIMME METER #
- platform: dsmr
port: /dev/ttyUSB0
dsmr_version: 4
- platform: template
sensors:
# DSMR METER READINGS #
# CALCULATION TARIF LOW + NORMAL
hourly_energy:
friendly_name: Hourly energy
unit_of_measurement: kWh
value_template: "{{ states('sensor.hourly_energy_offpeak')|float + states('sensor.hourly_energy_peak')|float }}"
daily_energy:
friendly_name: Daily energy
unit_of_measurement: kWh
value_template: "{{ states('sensor.daily_energy_offpeak')|float + states('sensor.daily_energy_peak')|float }}"
weekly_energy:
friendly_name: Weekly energy
unit_of_measurement: kWh
value_template: "{{ states('sensor.weekly_energy_offpeak')|float + states('sensor.weekly_energy_peak')|float }}"
monthly_energy:
friendly_name: Monthly energy
unit_of_measurement: kWh
value_template: "{{ states('sensor.monthly_energy_offpeak')|float + states('sensor.monthly_energy_peak')|float }}"
yearly_energy:
friendly_name: Yearly energy
unit_of_measurement: kWh
value_template: "{{ states('sensor.yearly_energy_offpeak')|float + states('sensor.yearly_energy_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 energy
yesterday_energy:
friendly_name: Yesterday energy
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.daily_energy_offpeak','last_period')|float + state_attr('sensor.daily_energy_peak','last_period')|float }}"
last_week_energy:
friendly_name: Last Week energy
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.weekly_energy_offpeak','last_period')|float + state_attr('sensor.weekly_energy_peak','last_period')|float }}"
last_month_energy:
friendly_name: Last Month energy
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.monthly_energy_offpeak','last_period')|float + state_attr('sensor.monthly_energy_peak','last_period')|float }}"
last_year_energy:
friendly_name: Last Year energy
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.yearly_energy_offpeak','last_period')|float + state_attr('sensor.yearly_energy_peak','last_period')|float }}"
# SHORT energy
daily_energy_short:
value_template: "{{ '%.3f'%(states('sensor.daily_energy') | float) | float }}"
unit_of_measurement: 'kWh'
yesterday_energy_short:
value_template: "{{ '%.3f'%(states('sensor.yesterday_energy') | float) | float }}"
unit_of_measurement: 'kWh'
weekly_energy_short:
value_template: "{{ '%.3f'%(states('sensor.weekly_energy') | float) | float }}"
unit_of_measurement: 'kWh'
last_week_energy_short:
value_template: "{{ '%.3f'%(states('sensor.last_week_energy') | float) | float }}"
unit_of_measurement: 'kWh'
monthly_energy_short:
value_template: "{{ '%.3f'%(states('sensor.monthly_energy') | float) | float }}"
unit_of_measurement: 'kWh'
last_month_energy_short:
value_template: "{{ '%.3f'%(states('sensor.last_month_energy') | float) | float }}"
unit_of_measurement: 'kWh'
yearly_energy_short:
value_template: "{{ '%.3f'%(states('sensor.yearly_energy') | float) | float }}"
unit_of_measurement: 'kWh'
last_year_energy_short:
value_template: "{{ '%.3f'%(states('sensor.last_year_energy') | float) | float }}"
unit_of_measurement: 'kWh'
# CACULATIONS
energy_kwh_to_watt:
friendly_name: 'Actueel Watt'
unit_of_measurement: 'Watt'
value_template: "{{ (states.sensor.power_consumption_phase_l1.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_energy_day:
unit_of_measurement: 'kWh'
value_template: >-
{% set a = states('sensor.last_month_energy') | 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 energy
today_energy_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.daily_energy') | 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_energy_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.yesterday_energy') | 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_energy_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.weekly_energy') | 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_energy_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_week_energy') | 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_energy_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.monthly_energy') | 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_energy_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_month_energy') | 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_energy_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.yearly_energy') | 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_energy_price:
unit_of_measurement: 'EUR'
value_template: >-
{% set a = states('sensor.last_year_energy') | 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) }}
lovelace:
entities:
- entity: input_number.all_in_enkeltarief_stroom
icon: 'mdi:flash'
name: Tarief per kWh
- entity: input_number.netbeheerkosten_stroom
icon: 'mdi:flash'
name: Vaste netbeheerkosten per jaar
- entity: input_number.vaste_leveringskosten_stroom
icon: 'mdi:flash'
name: Vaste leveringskosten per jaar
- entity: input_number.vermindering_energiebelasting_stroom
icon: 'mdi:flash'
name: Vermindering energiebelasting per jaar
- entity: input_number.all_in_enkeltarief_gas
icon: 'mdi:fire'
name: Tarief per m3
- entity: input_number.vaste_leveringskosten_gas
icon: 'mdi:fire'
name: Vaste leveringskosten per jaar
- entity: input_number.netbeheerkosten_gas
icon: 'mdi:fire'
name: Netbeheerkosten per jaar
show_header_toggle: false
title: Tarieven
type: entities
Have you set your input number somewhere? Cant find them in your configuration. You don’t have to use these but if you leave these then it is necessary to use fixed price values in your calculations.
srry. forgot that one
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: -527.17
min: -600.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'