Daily min max temperature with time stamp

Hi there

I am currently testing some code to get a daily min and max values from a temperature
sensor. Together with the min max values, a time stamp should be generated as well e.q. when was the min max value generated.
Did not yet find a proper solution, but I am sure, I am not the first one with such a request.
Does anybody has some advise/code which is working for this?

Thank you!

Do you need this as a sensor or just for display purposes?

Mini-graph-card provides this functionality, but only for lovelace.

Have a look

temp

type: 'custom:mini-graph-card'
entities:
  - entity: sensor.home_temperature
show:
  extrema: true
  average: true
  graph: false
hour24: true
hours_to_show: 48

1 Like

You could have a input_number and two automations.
One that at midnight sets the input_number.max to -99 or something, and another automation that triggers when the current temperature is higher than max, then it updated the max number.
Then you would need the same setup for min except the midnight reset has to set min to 99, but it can do both min and max in the same automation.
So three automations in total.

Thank you, I know about this function, but I need the values as sensors, so not just to display.

this should help

1 Like

Thank you for the hint about the statistics integration. I am aware of it, already running. But there are two major disadvantages (for my application)

  1. no time stamp on min/max value
  2. time intervall is moving, so when I want to have 24h within a fixed time, this could not be done

Maybe there is a work around on those two concerns? Thx

Have a look at this. It satisfies your mean/max and time frame needs.
Maybe not the timestamp part.

As for the timestamp part, with a bit of effort you can probably export the values and their timestamp directly from your database, using the sql sensor.

Iā€™m looking for the same thing and am actually surprised this is not available. I might go about this with some appdaemon code.
Basically at midnight
Max = current value
Min = current value

On updates
If current < min then min = current

And the same for max of course.