Get Min and Max from a Thermometer Sensor

I have an outdoor thermometer that I am displaying the current temp on my dashboard. What I would like is to also display the Min and Max temperatures of the day.

The history is there as I can display it is a Statistics Graph.

How do I extract the Min and Max from the entity ?

Thanks

Not sure about today, but this will give you the last 24 hours…

sensor:
  - platform: statistics
    name: "temp"
    entity_id: sensor.temperature
    state_characteristic: value_max
    max_age:
      hours: 24

Replace value_max with value_min for min,

Built-in min/max is kinda “odd”, since it always look for, say, last 24 hours, which can be wrong… as such for instance it shows max temp. of 36 degrees at 6 am in the morning, since it shows max from yesterday afternoon. If i lower hours value then it can happen that it doesn’t take into account today’s values… So, basically, it’s pretty much useless for tempereture purpose.
I’m using THIS addon, it’s more usefull, because it resets itself at midnight, so it really shows min/max for TODAY ONLY. I used to use sql before, but this suits my needs just fine now.

I use a template sensor in the configuration.yaml which is set up like this:

template:
  - trigger:
      - platform: time
        at: '00:00:00'
      - platform: state
        entity_id: sensor.tesla_pw2_solar_power_w
    sensor:
      - name: 'Solar Power Max Daily W'
        unique_id: 'tesla_pw2_solar_power_w_daily_max'
        unit_of_measurement: 'W'
        device_class: power
        state: >
          {% set t_new = states('sensor.tesla_pw2_solar_power_w') | float(-50) | int() %}
          {{ [t_new, this.state | float(-50) | int()] | max if trigger.platform != 'time' else t_new }}

Interesting topic !
I’m migrating automations of the shutters in Home assistant.

Opening :
When : at max (07:00 ; sunrise)
If : min_outdoor_temperature > 2°C (and on working day)

Then I need the minimum outdoor tempeture of the day to know if it has frozen during the night

I will give a try the Daily Min Max

1 Like