Best way to track temperature drop


what is the best way to track sudden value drops.
I‘d like to use this for an open window detection (Winter is coming…).

Example automation configs are welcome.

Is there a way to differentate a function to get the gradient in HA?

Whenever any entity in HA changes state (either its state string or any of its attributes), it causes a state_changed event. An automation can be triggered by such a state change, and the automation can have a condition that looks at the details of the change to decide if some action(s) should be run. So, e.g., let’s say you have a sensor (say, sensor.my_sensor), whose state is some value you want to check for a sudden change in. You could do something like this:

  - alias: Check for sudden change
      platform: state
      entity_id: sensor.my_sensor
      condition: template
      value_template: >
        {{ (trigger.to_state.state|float - trigger.from_state.state|float)|abs > XX }}
      # Do something...

The trend sensor can be helpful in determining how something is changing.