How to create a template sensor that tracks the lowest output of this temperature sensor

Looking for ideas on how to create a template sensor that provides the curve shown by the lower values of this sensor graph:

This is the output of a temperature sensor built into an ESP32 chip as provided by ESPHome. It tracks the CPU core temperature. The max value is always 53.3 degrees C (so far) and the low values varies with the outside temperature. I’m guessing when the CPU is working the high value is produced, and when idle the low value is produced.

I’d like to create a template sensor that tracks that lower curve (including if it goes above 53.3) so I can know if the device gets “too hot”. The device is in a weather tight box.

I’m guessing something like the statistics integration would be helpful here, but personal experience is limited in this area.

Any thoughts on how to produce a curve that varies with the idle temperature? I’m assuming I can’t just throw out the 53.3 C values as I don’t know if that will remain as the ceiling value once it gets hot here in South Texas. :slight_smile:

sensor:
  - platform: statistics
    name: "Internal temperature 15 Minute Minimum"
    entity_id: sensor.your_esp_temperature_sensor_here
    state_characteristic: value_min
    max_age:
      minutes: 15

You want the max age to be longer than the largest gap you see going to 53.3°C.

8cd6328fc49898bfab12c3318dfe1092c7f290e9

Otherwise you will see spikes to 53.3 on your graph.

Use the history panel to zoom in on the area of interest to get an accurate value.

Thanks, I’ll give that a shot!