The following Trigger-based Template Sensor reports the highest daily temperature (based on whatever temperature sensor you specify).
- trigger:
- platform: time
at: '00:00:00'
- platform: state
entity_id: sensor.outdoor_temperature
sensor:
- name: 'Today Max Temp'
unit_of_measurement: '°C'
device_class: temperature
state: >
{% set t_new = states('sensor.outdoor_temperature') | float(-99) %}
{{ [t_new, this.state | float(-99)] | max if trigger.platform != 'time' else t_new }}
attributes:
temperature_updated: "{{ now() | as_local }}"
It’s initial value will be unknown
. It will begin reporting a value when the temperature sensor’s value changes. At midnight (start of a new day) it sets its value to whatever is the temperature sensor’s current value.
A similar Trigger-based Template Sensor can be created for reporting the daily minimum temperature (replace the template’s max
filter with min
).