Add MQTT sensor output to Energy Consumption

I have an efergy power monitor that broadcasts instantaneous usage data in Watts every 10s or so. I am capturing this with an RTL-SDR module and pushing it to HA using MQTT. This is all working well and I get a value in Sensors showing my current power usage in W that corresponds with what shows up on the LCD for the efergy monitor.

My sensor is defined like so:

mqtt:
  sensor:
    unique_id: 'efergy_monitor'
    name: 'Energy Usage'
    state_topic: 'energy/maintariff'
    value_template: "{{ value.split(',')[2] }}"
    device_class: energy
    unit_of_measurement: W

When I try to add this to Home Assistant’s Energy Consumption module, I get “No Matching Statistics Found” - what do I need to do to make this data compatible with the Energy Consumption module?

looking to solve a similar problem when energy sensors from my inverter are in home assistant via MQTT but they don’t appear as entities to add in the energy dashboard.

Did you you ever solve this?

Easy. Add: state_class: measurement :slight_smile:

thanks, I solved following this approach from the docs Integration - Riemann sum integral - Home Assistant

sensor:
  - platform: integration
    source: sensor.current_power
    name: energy_spent
    unit_prefix: k
    round: 2

Mark,
I would love to build what you have built to remove my dependancy on the woefully unreliable Efergy servers. Have you documented your hardware and software build anywhere? Are you willing to do so?

I have read about a few SDR projects to decode the Efergy data transmissions, but while at a stretch, I might get one of them to work - I would have no idea how to get it into HA. I have always dreamed of trying MQTT, so this sounds like a perfect interface for me.

Ian