Efficient Energy Monitoring with Riemann Integration

Hi everyone, I wanted to share my experience with setting up energy monitoring using the Riemann integration method. I’ve been trying to convert my power usage (in kW) to kWh for my energy dashboard, and it’s been a bit of a journey!

I found that most tutorials use the utility_meter integration, but it doesn’t seem to work with the new energy dashboard requirements. After some research, I decided to go with the Riemann integration approach. Here’s how I set it up:

  1. Input Sensor: I started with my actual power usage sensor, which shows peaky usage patterns.
  2. Integration Sensor: I used the following configuration to integrate the power sensor and get kWh values:
    yaml
    sensor:
  • platform: integration
    source: sensor.actual_power
    name: gasverbrauch_kwh_integriert
    unit_prefix: k
    method: left
    round: 2
  1. Pseudo Sensor: To make it compatible with the energy dashboard, I created a pseudo sensor using a template:
    yaml
    template:
  • sensor:
    name: Gasverbrauch Dummy Sensor
    unique_id: gasverbrauch_dummy_sensor
    device_class: gas
    unit_of_measurement: “kwh”
    state: “{{ (states(‘sensor.gasverbrauch_kwh_integriert’) | float(0)) }}”
    state_class: total_increasing

Initially, I faced some issues where the integration sensor wasn’t showing the expected results, but after some tweaking and using the Helper Widget in my energy dashboard, everything started working smoothly!

This setup has been a game-changer for tracking my energy usage more accurately. I’d love to hear if anyone else has tried similar methods or has tips for improving this further. Happy automating! :rocket: