Trying it in Blockly and looking at the code is an excellent suggestion. In addition:
- Design Pattern: Motion Sensor Timer
- Threshold Alert and Open Reminder [4.0.0.0;5.9.9.9]
- Link the same channel to a datetime Channel using the datetime profile. Set an expire on the Item. Trigger a rule when the Item changes to UNDEF. In the rule check to see if the window is OPEN and if so send your alert.