Bar chart with total daily kwh from Sonoff S31 plug

Is there a way I can display a bar chart (ideally with mini-graph-chart) that displays the total kWh used each day by a Sonoff S31 power monitoring plug?

I have already set the sensor for watts in HA but I can’t find how to import the daily kWh from the eWeLink app

Basically what I want to do is to have the same bar chart as the one in the official eWeLink app:


ideally the last 30 days with 1 bar representing 1 day, but I don’t mind if it’s just the current month like in the app

I have also added the sonoff sensor to HA’s energy tab, but I want the bar chart to display as a LoveLace card and not just when clicking in the energy section

Would appreciate some help. Thanks!

Still trying to figure this out…

Let’s begin with the kWh. The eWeLink app has a feature to track the kWh but I couldn’t find how to import it in HA. So I am using the “integration sensor” workaround here: Integration - Riemann sum integral - Home Assistant

An integration sensor is quite useful in energy billing scenarios since energy is generally billed in kWh and many sensors provide power in W (Watts).
If you have a sensor that provides you with power readings in Watts (uses W as unit_of_measurement), then you can use the integration sensor to track how much energy is being spent.

my code:

- platform: integration
name: All Grow Tents kWh
source: sensor.all_grow_tent_watts
unit_prefix: k
unit: kWh
round: 2
cycle: daily

  all_grow_tent_watts:
    friendly_name: "Total electricity usage (Grow tents)"
    unit_of_measurement: 'W'
    value_template: "
    {{ 
        float(states('sensor.sonoff_10014f7842_power')) 
        + float(states('sensor.sonoff_10014f7776_power'))
        + float(states('sensor.sonoff_10014f79b4_power')) 
        + float(states('sensor.sonoff_10014f789e_power')) 
    }}
    "

am I doing this correctly or is there a better way to track kWh from a Sonoff S31 ?

now how I go from here and generate the bar chart graph?

1 Like

… anyone? :frowning:

Still looking for a solution

Utility meter?
Riemann sum?
Integration integration?

I just want a daily bar chart with kWh consumed for each day…