I’ve been working to reduce the size of my database by using Purge weekly to only retain 7 days history. However, when I look at a sensor’s history is shows “history” and then also “long term history” information. The “history” seems to be the data within the purge date range. How do I maintain control of the long term history stats?
The light blue on the left is the long term history.
You don’t. It is kept forever as it takes up very little space. Only one data point per hour (for each of max/min/avg or total) per sensor. So 24 or 72 points per day. At 64 bits per data point that is (worst case) ~1.6MB per year per sensor.
If you delete the state_class attribute of your sensor no LTS will be kept.