Need Max Value for the day

template:
  - trigger:
      - platform: time
        at: '00:00:00'
      - platform: state
        entity_id: sensor.thermometer_woonkamer_temperatuur
    sensor:
      - name: MaxTempWoonkamerVandaag
        unit_of_measurement: '°C'
        device_class: temperature
        state: >
          {% set t_new = states('sensor.thermometer_woonkamer_temperatuur') | float(-99) %}
          {{ [t_new, this.state | float(-99)] | max if trigger.platform != 'time' else t_new }}
        attributes:
          temperature_updated: "{{ now() | as_local }}"

Initially its value will probably be unknown. When the value of sensor.thermometer_woonkamer_temperatuur changes, then it will report a numeric value.


NOTE

The example is based on a similar one I posted here in December 2022