Sensor statistics

Hello! I am struggling with something that seems should be a no-brainer in HA:
I have built a sensor that reads a led pulse from my energy meter. The sensor sends a MQTT-message every time my home has consumed 1/500 kWh. I have made sure that HA can read and parse the message. How should I configure in HA, so that my energy consumption is persisted, aggregated and possible to chart by minute and hour?


Your sensor must have a state_class set. Either measurement, total or total_increasing.

More info here: Sensor Entity | Home Assistant Developer Docs

You can set the state_class using customization or from the sensor if available (check the documentation for your template sensor or MQTT sensor)