This one uses a group of doors/windows. After the group has been on for 5 minutes it will pull a list of which doors/windows are open and send the notification. If I were to re-do this today I’d drop the switch node. I would still use the timer over the built-in “For X minutes” because I want the action to fire right when the doors close not after they’ve been closed for 5 minutes.
For the second notification when they close only if a notification was sent, I’d probably create a helper entity here. Along with sending the first notification I’d turn that entity on. Then when the door closes, if that entity is on send the second notification and turn the entity off.
[{"id":"42442f06.7b14f","type":"server-state-changed","z":"5ddddd21.00d204","name":"Door/Window Open","server":"94fdcfdf.a00b","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"group.doors_windows","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":110,"y":1700,"wires":[["5cb1066a.159528"]]},{"id":"5cb1066a.159528","type":"switch","z":"5ddddd21.00d204","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":1700,"wires":[["92868919.54d7a8"],["a13066de.6decb8"]]},{"id":"92868919.54d7a8","type":"stoptimer","z":"5ddddd21.00d204","duration":"5","units":"Minute","payloadtype":"num","payloadval":"0","name":"5 Minutes","x":600,"y":1700,"wires":[["3b2966e7.564c1a"],[]]},{"id":"a13066de.6decb8","type":"change","z":"5ddddd21.00d204","name":"Stop Timer","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1760,"wires":[["92868919.54d7a8","a154c077.9126e"]]},{"id":"a154c077.9126e","type":"api-call-service","z":"5ddddd21.00d204","name":"Door/Window Closed","server":"94fdcfdf.a00b","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.door_open"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":800,"y":1760,"wires":[[]]},{"id":"3b2966e7.564c1a","type":"ha-get-entities","z":"5ddddd21.00d204","name":"Which Doors/Windows?","server":"94fdcfdf.a00b","version":0,"rules":[{"property":"entity_id","logic":"in_group","value":"group.doors_windows","valueType":"str"},{"property":"state","logic":"includes","value":"on, open","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":810,"y":1680,"wires":[["e0d33504.13ee68"]]},{"id":"e0d33504.13ee68","type":"template","z":"5ddddd21.00d204","name":"Format Msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.attributes.friendly_name}}","output":"str","x":1030,"y":1680,"wires":[["ce669e51.69747"]]},{"id":"ce669e51.69747","type":"join","z":"5ddddd21.00d204","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":", ","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1190,"y":1680,"wires":[["1c2550a2640ca9a1"]]},{"id":"1c2550a2640ca9a1","type":"function","z":"5ddddd21.00d204","name":"","func":"open = msg.payload\n\nmsg.payload = {\n data: {\n title: \"Temperature\",\n message: open + \" left open for 5 minutes. Thermostats turned off\",\n data: {\n notification_icon: 'mdi:radiator-off',\n tag: 'temperature',\n channel: \"Thermostat\",\n ttl: 0,\n importance: 'default', \n clickAction: 'dwains-dashboard/room_living_room_climate',\n }\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1340,"y":1680,"wires":[["f39269872647603d"]]},{"id":"f39269872647603d","type":"api-call-service","z":"5ddddd21.00d204","name":"Notify","server":"94fdcfdf.a00b","version":5,"debugenabled":false,"domain":"notify","service":"all_phones","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"callServiceData","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1470,"y":1680,"wires":[[]]},{"id":"94fdcfdf.a00b","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]