Mqtt sensor : too many record on my .db

I’ve setup an arduino to publish into mqqt my real time electricity consumption. I wanted to draw some graph about this consumtion so I add this sensor into the recorder.
The problem is that every second it publish the meter value and at the end of the day I get a +100Mb data file of current data… I totaly don’t care that at 9:30:32.254 I was consuming 2.25A. I only want to visualize the trend for days/week.
What are the solutions ?
I tried to add scan_interval, force_update into my sensor configuration but nothing works.
Once my .DB get 1Go, the server feel slower.

Use influxdb to store your electricity consumption and grafana to visualize it.


Set up your arduino to publish less often.

I had the same issue with my energy monitor.

For me anyway, the solution was to completely bypass Home Assistant when saving the data. Instead of publishing via MQTT, I added to a MySQL DB. Then used SQL sensors in Home Assistant to read from the DB.

Details in this thread: How To Save Sensor Data To MySQL Database?

Thanks, I’ll look carefully at what you did and try. Did you try the influx db solution before the deported mysql data base?

I didn’t use Influx as I didn’t want another database / software package to maintain, configure, etc. Since I already had MySQL installed for Home Assistant it seemed like the logical choice.