How to generalise automation for notification?

May be the blueprint Contact Sensor (Door or Window) Left Open Notification helps.
You can simply add additonal conditions (like the temperature) for your notifications and it works out of the box.