How to prevent spikes in energy view - using P1/DSMR USB for readout

Hi all,

I have a special usb cable connected between the p1 port of our home energy meter and my RPI which runs Home Assistant. I use the DSMR integration in HA to readout values in Home Assistant.

I use the consumption/production sensors created by the DSMR integration to populate the energy view.
image

With this setup I normally get a nice overview of my production, consumption and how much I used from / pushed into the grid.

Sometimes I see big positive or negative spikes that ruin my overviews. see example

Q1: why do I get spikes?
Q2: how can I prevent spikes in future?
Q3: how can I “repair” spikes that occurred in the past?

Thanks for help!

Grtz,
Jules

Because when your energy sensor disconnects or becomes unavailable it reports 0 instead of unavailable. Then when it reconnects there’s a massive jump from 0 to whatever your energy running total is.

You can filter the sensor. Here’s how I did it for my SMA Inverter:

Wait until tomorrow (v2022.4 release) :slight_smile:

thanks for the tips!

I created below “stabilised” sensors according your suggestions and replaced them in my energy dashboard. The stabilised sensors are based on the original sensors.

    - name: "gas_stabilised" 
      icon: "mdi:counter"
      unit_of_measurement: "m³"
      device_class: energy
      state_class: total_increasing
      state: "{{ states('sensor.gas_consumption')|float(2) }}"
      availability: "{{ states('sensor.gas_consumption')|float(2) > 100 }}"


    - name: "envoy_production_stabilised" 
      icon: "mdi:counter"
      unit_of_measurement: "Wh"
      device_class: energy
      state_class: total_increasing
      state: "{{ states('sensor.envoy_122127012249_lifetime_energy_production')|float(2) }}"
      availability: "{{ states('sensor.envoy_122127012249_lifetime_energy_production')|float(2) > 100 }}"


    - name: "solar_edge_production_stabilised" 
      icon: "mdi:counter"
      unit_of_measurement: "Wh"
      device_class: energy
      state_class: total_increasing
      state: "{{ states('sensor.solaredge_production_energy')|float(2) }}"
      availability: "{{ states('sensor.solaredge_production_energy')|float(2) > 100 }}"

two problems:

1: With the new sensor I get new mega spike

See screenshot as example

2: looking back all in my history in the energy dashboard, all produced solar has disappeared. See screenshot as example

Any suggestions?

Thanks!!

Grtz
Jules