DSMR - monthly 15 minute peak values for Belgium

Ah thanks for mentioning.
Unfortunately, I have the P1 directly connected to my HA Blue with a P1/usb convertor and using the standard DSMR integration :smirk:.

Otherwise it us pretty easy with mqtt:

    - name: "Kwartierpiek maand"
      state_topic: "dsmr/consumption/peak/running_month" 
      unit_of_measurement: "kW"
      payload_available: "online"
      payload_not_available: "offline"

I am still figuring out how to display the monthly peaks and calculate the average
this is the raw data

(3)(1-0:1.6.0)(1-0:1.6.0)(230101000000W)(221226183000W)(04.284*kW)(230201000000W)(230102030000W)(04.327*kW)(230301000000W)(230216210000W)(03.096*kW)
2 Likes

Nice!
Iā€™m looking forward to the monthly peaks (and maybe a graph that can display the monthly peaks).
Sadly I donā€™t have the knowledge to help with thisā€¦

+1

Iā€™m currently trying to get correct tarifs in my HA installation and this would be needed in order to calculate correctly

So I started an attempt to calculate the actual price based on all the different factors mentioned on my invoice (total energies). I made a ā€œhelperā€ for every one of these factors and wrote a formula for seperate sensors for peak and low tarif + total price. This I repeated for day, week, month, quarterly and yearly costs.

The only part I still need to tackle is the ā€œcapaciteitstariefā€ which calculates a fee per kWh based on the kWh consumed in the ā€œhighestā€ 15min consumption window every month. For now in my code I took this as a monthly cost of 16 euro since that is what they charged me the past 2 months (value ā€œgā€ in the code). I would like to replace this by the actual consumption, but no idea on how to tackle this. Anyone that might be able to help in this?

#### Elektriciteitsverbruik - Sensoren 

utility_meter:
### Piekuren
  elektriciteitsverbruik_piek_dit_kwartier:
    source: sensor.electricity_meter_energy_consumption_tarif_1
    cycle: quarter-hourly
  elektriciteitsverbruik_piek_dit_uur:
    source: sensor.electricity_meter_energy_consumption_tarif_1
    cycle: hourly
  elektriciteitsverbruik_piek_vandaag:
    source: sensor.electricity_meter_energy_consumption_tarif_1
    cycle: daily
  elektriciteitsverbruik_piek_deze_week:
    source: sensor.electricity_meter_energy_consumption_tarif_1
    cycle: weekly
  elektriciteitsverbruik_piek_deze_maand:
    source: sensor.electricity_meter_energy_consumption_tarif_1
    cycle: monthly
  elektriciteitsverbruik_piek_dit_kwartaal:
    source: sensor.electricity_meter_energy_consumption_tarif_1
    cycle: quarterly
  elektriciteitsverbruik_piek_dit_jaar:
    source: sensor.electricity_meter_energy_consumption_tarif_1
    cycle: yearly
  elektriciteitsverbruik_piek_all_time:
    source: sensor.electricity_meter_energy_consumption_tarif_1
### Daluren
  elektriciteitsverbruik_dal_dit_kwartier:
    source: sensor.electricity_meter_energy_consumption_tarif_2
    cycle: quarter-hourly
  elektriciteitsverbruik_dal_dit_uur:
    source: sensor.electricity_meter_energy_consumption_tarif_2
    cycle: hourly
  elektriciteitsverbruik_dal_vandaag:
    source: sensor.electricity_meter_energy_consumption_tarif_2
    cycle: daily
  elektriciteitsverbruik_dal_deze_week:
    source: sensor.electricity_meter_energy_consumption_tarif_2
    cycle: weekly
  elektriciteitsverbruik_dal_deze_maand:
    source: sensor.electricity_meter_energy_consumption_tarif_2
    cycle: monthly
  elektriciteitsverbruik_dal_dit_kwartaal:
    source: sensor.electricity_meter_energy_consumption_tarif_2
    cycle: quarterly
  elektriciteitsverbruik_dal_dit_jaar:
    source: sensor.electricity_meter_energy_consumption_tarif_2
    cycle: yearly
  elektriciteitsverbruik_dal_all_time:
    source: sensor.electricity_meter_energy_consumption_tarif_2
  
#### Elektriciteitskosten - Berekeningen

sensor:
  - platform: template
    sensors:
### Elektriciteitskosten - Per dag
      elektriciteitskost_piek_per_dag:
        friendly_name: "Kosten Elektriciteit Piekuren Vandaag"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_piek_vandaag') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float  %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float / 30 %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float / 30 %}
          {{ (((z * (a + c + f + h + i + j)) + ((g + d + ((e + k) * 100)))/2)/100) | round(2) }}
          
      elektriciteitskost_dal_per_dag:
        friendly_name: "Kosten Elektriciteit Daluren Vandaag"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_dal_vandaag') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float  %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float / 30  %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float / 30 %}
          {{ (((z * (b + c + f + h + i + j)) + ((d + ((g + e + k) * 100)))/2)/100) | round(2) }}

      elektriciteitskost_totaal_per_dag:
        friendly_name: "Kosten Elektriciteit Totaal Vandaag"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {{ (states('sensor.elektriciteitskost_piek_per_dag') | float + states('sensor.elektriciteitskost_dal_per_dag') | float) | round(2) }}
          
### Elektriciteitskosten - Per week
    
      elektriciteitskost_piek_per_week:
        friendly_name: "Kosten Elektriciteit Piekuren deze week"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_piek_deze_week') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float * 7 %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float * 7 %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float / 4 %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float / 4 %}
          {{ (((z * (a + c + f + h + i + j)) + ((d + ((g + e + k) * 100)))/2)/100) | round(2) }}
          
      elektriciteitskost_dal_per_week:
        friendly_name: "Kosten Elektriciteit Daluren deze week"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_dal_deze_week') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float * 7 %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float * 7 %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float / 4  %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float / 4 %}
          {{ (((z * (b + c + f + h + i + j)) + ((d + ((g + e + k) * 100)))/2)/100) | round(2) }}

      elektriciteitskost_totaal_per_week:
        friendly_name: "Kosten Elektriciteit Totaal deze week"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {{ (states('sensor.elektriciteitskost_piek_per_week') | float + states('sensor.elektriciteitskost_dal_per_week') | float) | round(2) }}

### Elektriciteitskosten - Per maand
    
      elektriciteitskost_piek_per_maand:
        friendly_name: "Kosten Elektriciteit Piekuren deze maand"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_piek_deze_maand') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float * 30 %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float * 30 %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float %}
          {{ (((z * (a + c + f + h + i + j)) + ((d + ((e + k + g) * 100)))/2)/100) | round(2) }}
          
      elektriciteitskost_dal_per_maand:
        friendly_name: "Kosten Elektriciteit Daluren deze maand"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_dal_deze_maand') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float * 30 %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float * 30 %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float %}
          {{ (((z * (b + c + f + h + i + j)) + ((d + ((e + k + g) * 100)))/2)/100) | round(2) }}

      elektriciteitskost_totaal_per_maand:
        friendly_name: "Kosten Elektriciteit Totaal deze maand"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {{ (states('sensor.elektriciteitskost_piek_per_maand') | float + states('sensor.elektriciteitskost_dal_per_maand') | float) | round(2) }}

### Elektriciteitskosten - Per kwartaal
    
      elektriciteitskost_piek_per_kwartaal:
        friendly_name: "Kosten Elektriciteit Piekuren dit kwartaal"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_piek_dit_kwartaal') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float * 90 %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float * 90 %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float * 3 %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float * 3 %}
          {{ (((z * (a + c + f + h + i + j)) + ((d + ((e + k + g) * 100)))/2)/100) | round(2) }}
          
      elektriciteitskost_dal_per_kwartaal:
        friendly_name: "Kosten Elektriciteit Daluren dit kwartaal"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_dal_dit_kwartaal') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float * 90 %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float * 90 %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float * 3  %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float * 3 %}
          {{ (((z * (b + c + f + h + i + j)) + ((d + ((e + k + g) * 100)))/2)/100) | round(2) }}

      elektriciteitskost_totaal_per_kwartaal:
        friendly_name: "Kosten Elektriciteit Totaal dit kwartaal"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {{ (states('sensor.elektriciteitskost_piek_per_kwartaal') | float + states('sensor.elektriciteitskost_dal_per_kwartaal') | float) | round(2) }}

### Elektriciteitskosten - Per jaar
    
      elektriciteitskost_piek_per_jaar:
        friendly_name: "Kosten Elektriciteit Piekuren dit jaar"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_piek_dit_jaar') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float * 365 %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float * 365 %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float * 12 %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float * 12 %}
          {{ (((z * (a + c + f + h + i + j)) + ((d + ((e + k + g) * 100)))/2)/100) | round(2) }}
          
      elektriciteitskost_dal_per_jaar:
        friendly_name: "Kosten Elektriciteit Daluren dit jaar"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set z = states('sensor.elektriciteitsverbruik_dal_dit_jaar') | float %}
          {% set a = states('input_number.elektriciteit_a_elektriciteitstarief_piekuren') | float %}
          {% set b = states('input_number.elektriciteit_b_elektriciteitstarief_daluren') | float  %}
          {% set c = states('input_number.elektriciteit_c_bijdrage_groene_energie_wkk') | float %}
          {% set d = states('input_number.elektriciteit_d_abbonnement') | float * 365 %}
          {% set e = states('input_number.elektriciteit_e_huur_meter') | float * 365 %}
          {% set f = states('input_number.elektriciteit_f_distributie') | float %}
          {% set g = states('input_number.elektriciteit_g_distributie_capaciteit') | float * 12  %}
          {% set h = states('input_number.elektriciteit_h_transport') | float %}
          {% set i = states('input_number.elektriciteit_i_bijzondere_accijns') | float %}
          {% set j = states('input_number.elektriciteit_j_energiebijdrage') | float  %}
          {% set k = states('input_number.elektriciteit_k_bijdrage_energiefonds') | float * 12 %}
          {{ (((z * (b + c + f + h + i + j)) + ((d + ((e + k + g) * 100)))/2)/100) | round(2) }}

      elektriciteitskost_totaal_per_jaar:
        friendly_name: "Kosten Elektriciteit Totaal dit jaar"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {{ (states('sensor.elektriciteitskost_piek_per_jaar') | float + states('sensor.elektriciteitskost_dal_per_jaar') | float) | round(2) }}

It was added in 2023.7, but documentation was still missing so I did a PR for the ESPHome docs.

Any news this will be implemented in the DSMR integration (P1)?

It has been added to the ESPHome DSMR component

Donā€™t know about the HA DSMR integration.

Well, guess weā€™re finally there for the november release :clap:

Thx @dupondje :slight_smile:
What additional sensors will become available?

We can start thinking about how to visualize it best in HA :grin:

Any help on the installation of this P1 to a ā€œslimme meterā€.
DSMR Asks for the host, port and version. How do I retrieve thins info?

If Iā€™m not mistaken host would be the IP of your slimme lezer.
Port try 23
Version depends on the digital meter, usually for Belgium this would be 5B.

I still donā€™t see new sensors for peak values for Belgium 5B meter

Interested as well!

Because I now I solve it by using the SQL integration to get the values of the 2 tarif consumption meters (latests vs 15 minutes ago) with additional calculations.
And this used to work flawless, but the values arenā€™t getting there anymore all the time, often resulting in empty or incorrect data.

I got the 2 new sensors since the november update. Try reloading the dsmr integration maybe?

What are they called?

Electricity Meter Maximum demand current month ā†’ for current month
Electricity Meter Current average demand ā†’ for current 15 minutes

2 Likes

Indeed, there are 2 additional sensors:

  • sensor.electricity_meter_huidig_gemiddelde_vraag
  • sensor.electricity_meter_maximale_vraag_huidige_maand

Initially these 2 sensors are not long term statistics. So Iā€™ve created them myself to have long term info.

I still donā€™t see them. I tried reloading, restarting, re-added the integrationā€¦
Turned on debug logging and this is what is received from the telegram:

2023-12-19 20:08:36.651 DEBUG (MainThread) [dsmr_parser.clients.protocol] got telegram: /FLU5\253769484_A

0-0:96.1.4(50215)
0-0:96.1.1(3153414733313035313231343931)
0-0:1.0.0(231219200833W)
1-0:1.8.1(000219.078kWh)
1-0:1.8.2(000196.630
kWh)
1-0:2.8.1(000000.000kWh)
1-0:2.8.2(000003.177
kWh)
0-0:96.14.0(0001)
1-0:1.7.0(00.839kW)
1-0:2.7.0(00.000
kW)
1-0:21.7.0(00.482kW)
1-0:41.7.0(00.352
kW)
1-0:61.7.0(00.004kW)
1-0:22.7.0(00.000
kW)
1-0:42.7.0(00.000kW)
1-0:62.7.0(00.000
kW)
1-0:32.7.0(235.6V)
1-0:52.7.0(237.1
V)
1-0:72.7.0(235.7V)
1-0:31.7.0(002.60
A)
1-0:51.7.0(001.98A)
1-0:71.7.0(000.48
A)
0-0:96.3.10(1)
0-0:17.0.0(999.9kW)
1-0:31.4.0(999
A)
0-0:96.13.0()
0-1:24.1.0(003)
0-1:96.1.1(37464C4F32313230303531323436)
0-1:24.4.0(1)
0-1:24.2.3(231219200504W)(02501.458*m3)
!909D

Solved, the firmware of my meter was not yet the latest version so it didnā€™t record the peak values.

Hello all,

Iā€™m reading along here and think itā€™s cool that the capacity tariff is readable. However, I donā€™t see it in my home assistant.

I read here that the firmware of the meter is not the latest? How can you update it?

I am using USB to P1 cable with home assistant DSMR integration.

[SOLVED] Tried global search on the name sensor.electricity_meter_maximale_vraag_huidige_maand
and found it. it wasnā€™t under DSMR integration