Sensor mAh

I’m using an INA219 DC Current Sensor, on an esp32 working with an 18650 battery. The INA219 on the esphome measures volts, amps, and watts. I would like to create a sensor that measures the mah spent on the battery. I’ve tried several solutions, but all have been unsuccessful. Does anyone have a solution? Thanks.

I have ESP-01/BME-280 temp,humidity and pressure sensors around the place sending the data to a MQTT server and reporting the data in gauges on my UI. I also access that data from places other then HA.