The script referenced at the end is what I actually do when the open window has been detected (in this case pause the heating), but you dont have to have it in a separate script, you could just perform the action in the actions section of the automation: