This seems to have solved the issue but I am only a couple days into testing it:
[{"id":"51842ffcd3eb0fe2","type":"server-state-changed","z":"22924e93ed954a8e","name":"Patio Door Lock","server":"6f1799ba.17e938","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"lock.patio_door_lock","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"locked","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":860,"wires":[["d02f9864197d1e25"],["4ac076533745c043"]]},{"id":"71cb21e6ed6b55b9","type":"api-current-state","z":"22924e93ed954a8e","name":"Patio Door Lock - locked?","server":"6f1799ba.17e938","version":3,"outputs":2,"halt_if":"locked","halt_if_type":"str","halt_if_compare":"is","entity_id":"lock.patio_door_lock","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"lock_state","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":970,"y":820,"wires":[["4fe487d897eb59a6"],["163d44f3692ba893"]]},{"id":"d02f9864197d1e25","type":"api-call-service","z":"22924e93ed954a8e","name":"Patio Door Lock >> refresh","server":"6f1799ba.17e938","version":5,"debugenabled":false,"domain":"zwave_js","service":"refresh_value","areaId":[],"deviceId":[],"entityId":["lock.patio_door_lock"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":380,"y":800,"wires":[["073416794055bd5e"]]},{"id":"4fe487d897eb59a6","type":"change","z":"22924e93ed954a8e","name":"5: C & L","rules":[{"t":"set","p":"msg_case","pt":"msg","to":"5","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":800,"wires":[["ffb557443cf6ac84"]]},{"id":"784605f84db31bba","type":"function","z":"22924e93ed954a8e","name":"Create Alert","func":"var alert_name = \"Door Status Alert\"\nvar door = \"Patio Door\"\nvar door_state = global.get('patio_door_state')\nvar lock_state = global.get('patio_door_lock_state')\nvar what_changed = global.get('patio_door_last_change')\nvar msg_case = msg.msg_case\nvar last_msg_case = global.get('patio_door_last_msg_case')\nvar suppress_alert = false\n\n/*\nDoor open / on | Door closed / off\nLock locked | Lock unlocked\n\nC-Closed / O-Open / L-Locked / U-Unlocked\n\nNormal Sequence\n1 D: Closed L: Locked C: na - Starting point, no message\n2 D: Closed L: *Unlocked* C: L - Door unlocked\n3 D: *Open* L: Unlocked C: D - Door open\n4 D: *Closed* L: Unlocked C: D - Door closed\n5 D: Closed L: *Locked* C: L - Door closed and locked\n*/\n\nglobal.set(\"patio_door_last_msg_case\", msg_case);\n\nswitch (msg_case) {\n case \"0\":\n suppress_alert = true\n break;\n case \"1\":\n var final_msg = `${door}` + \" or lock state is unavailable.\"\n break;\n case \"2\":\n var final_msg = `${door}` + \" is unlocked.\"\n break;\n case \"3\":\n var final_msg = `${door}` + \" is open.\"\n break;\n case \"4\":\n var final_msg = `${door}` + \" is closed.\"\n break;\n case \"5\":\n var final_msg = `${door}` + \" is closed and locked.\"\n break;\n case \"6\":\n var final_msg = `${door}` + \" is locked but the door is open. Please unlock to avoid frame damage.\"\n break;\n default:\n\n}\n\nif (suppress_alert == false || msg_case != \"0\") {\n var msg1 = {\n \"payload\":\n {\n \"data\":\n {\n \"message\": `${final_msg}`,\n \"title\": `${alert_name}`,\n \"data\": {\n \"type\": \"tts\"\n }\n }\n }\n }\n //var debug_msg = `${final_msg}`\n\n var msg2 = { payload: `${msg_case}` + \": \" + `${final_msg}` };\n\n return [msg1, msg2];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1510,"y":800,"wires":[["5c34aa4243f3a8e9","ee2633c185bca307"],["819cd6919690d243"]]},{"id":"819cd6919690d243","type":"debug","z":"22924e93ed954a8e","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1680,"y":860,"wires":[]},{"id":"ffb557443cf6ac84","type":"trigger","z":"22924e93ed954a8e","name":"500ms","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"500","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1350,"y":800,"wires":[["784605f84db31bba"]]},{"id":"ee2633c185bca307","type":"link out","z":"22924e93ed954a8e","name":"Play Patio Door Alert","mode":"link","links":["7d27c9ed96a7fe0f"],"x":1720,"y":800,"wires":[],"l":true},{"id":"5c34aa4243f3a8e9","type":"debug","z":"22924e93ed954a8e","name":"debug 8","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1680,"y":740,"wires":[]},{"id":"edb5eb9ad690d73a","type":"link out","z":"22924e93ed954a8e","name":"Play Backyard Gate Alert","mode":"link","links":["7d27c9ed96a7fe0f"],"x":1710,"y":660,"wires":[],"l":true},{"id":"a8ad65d4e90a36e9","type":"function","z":"22924e93ed954a8e","name":"Create Alert","func":"var dog_escape_msg = \"Attention! Backyard gate is open so dog can escape.\"\nvar alert_name = \"Dog Potential Escape Alert\"\n\n\nvar payload = {\"data\":\n{\n \"message\": `${dog_escape_msg}`,\n \"title\": `${alert_name}`,\n \"data\": {\n \"type\": \"tts\"\n }\n}\n}\nmsg.payload = payload\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1490,"y":660,"wires":[["edb5eb9ad690d73a"]]},{"id":"effe1446ad83724d","type":"api-current-state","z":"22924e93ed954a8e","name":"Backyard Gate - open?","server":"6f1799ba.17e938","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.backyard_gate","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":730,"y":680,"wires":[["a8ad65d4e90a36e9"],[]]},{"id":"7873bd3fcf092a76","type":"switch","z":"22924e93ed954a8e","name":"Open / Closed","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":500,"y":680,"wires":[["effe1446ad83724d"],[]]},{"id":"6d5e223249201ff9","type":"delay","z":"22924e93ed954a8e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":320,"y":680,"wires":[["7873bd3fcf092a76"]]},{"id":"667458a8d55a5ac4","type":"server-state-changed","z":"22924e93ed954a8e","name":"Backyard Gate","server":"6f1799ba.17e938","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.backyard_gate","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":620,"wires":[["7c4ca5dc811dc1cf"],[]]},{"id":"695fc23dc274fb2d","type":"api-current-state","z":"22924e93ed954a8e","name":"Patio Door - open?","server":"6f1799ba.17e938","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.patio_door","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":710,"y":620,"wires":[["a8ad65d4e90a36e9"],[]]},{"id":"7c4ca5dc811dc1cf","type":"delay","z":"22924e93ed954a8e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":320,"y":620,"wires":[["695fc23dc274fb2d"]]},{"id":"073416794055bd5e","type":"ha-wait-until","z":"22924e93ed954a8e","name":"Patio Door Lock - locked? - 1.5s","server":"6f1799ba.17e938","version":2,"outputs":2,"entityId":"lock.patio_door_lock","entityIdFilterType":"exact","property":"state","comparator":"is","value":"locked","valueType":"str","timeout":"1500","timeoutType":"num","timeoutUnits":"milliseconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":670,"y":800,"wires":[["4fe487d897eb59a6"],["71cb21e6ed6b55b9"]]},{"id":"163d44f3692ba893","type":"change","z":"22924e93ed954a8e","name":"4: C","rules":[{"t":"set","p":"msg_case","pt":"msg","to":"4","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1190,"y":840,"wires":[["ffb557443cf6ac84"]]},{"id":"b50c67b2697af741","type":"server-state-changed","z":"22924e93ed954a8e","name":"Patio Door","server":"6f1799ba.17e938","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.patio_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":760,"wires":[["5c85c51ebdb10cdb","6d5e223249201ff9"],["d02f9864197d1e25"]]},{"id":"5c85c51ebdb10cdb","type":"change","z":"22924e93ed954a8e","name":"3: O","rules":[{"t":"set","p":"msg_case","pt":"msg","to":"3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1190,"y":760,"wires":[["ffb557443cf6ac84"]]},{"id":"f06b0d0fd1d1d4c6","type":"change","z":"22924e93ed954a8e","name":"6: O & L","rules":[{"t":"set","p":"msg_case","pt":"msg","to":"6","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":720,"wires":[["ffb557443cf6ac84"]]},{"id":"4a6349972fb6c634","type":"change","z":"22924e93ed954a8e","name":"2: U","rules":[{"t":"set","p":"msg_case","pt":"msg","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1190,"y":880,"wires":[["ffb557443cf6ac84"]]},{"id":"4ac076533745c043","type":"ha-wait-until","z":"22924e93ed954a8e","name":"Patio Door - closed? - 1.5s","server":"6f1799ba.17e938","version":2,"outputs":2,"entityId":"binary_sensor.patio_door","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"1500","timeoutType":"num","timeoutUnits":"milliseconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":380,"y":880,"wires":[[],["06270a8572472812"]]},{"id":"06270a8572472812","type":"api-current-state","z":"22924e93ed954a8e","name":"Patio Door - open?","server":"6f1799ba.17e938","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.patio_door","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":630,"y":880,"wires":[[],["4a6349972fb6c634"]]},{"id":"6f1799ba.17e938","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
I was trying to keep the node spaghetti simple and do more in the function node but given the door and lock messages have random timing, I had to sort out what was actually happening outside of the function node which now only plays the correct message. The waits and delays are there to try to avoid pointless alerts such as unlocked door when it typically opens (and is therefore obviously unlocked) immediately afterwards. It also gives time for the slower locks to report.
The “O & L” is not connected as that requires added logic that I have not worked on yet and would likely introduce some complications… It is when the lock is locked but the door is open which would result in door frame damage… problem is I need to know for certain that the lock locked AFTER the door was opened because I otherwise get that alert when the door opens and the lock has not reported unlocked yet… but that may not be true in this latest revision of the flow as I don’t even check the lock when the door opens… cause it is obviously unlocked.