This is a flow I wrote to help another user checking doors. It doesn't use HA but may give you ideas of how to achieve what you want to do.
[{"id":"b946b6d6f1384bbd","type":"inject","z":"397c2f459ec16f88","name":"Front door unlocked","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Front door","payload":"unlocked","payloadType":"str","x":150,"y":200,"wires":[["ebe70eb3bfe15eeb"]]},{"id":"5bdafdb6d195bc3f","type":"inject","z":"397c2f459ec16f88","name":"Front door locked","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Front door","payload":"locked","payloadType":"str","x":140,"y":240,"wires":[["ebe70eb3bfe15eeb"]]},{"id":"093316f2d930fb91","type":"inject","z":"397c2f459ec16f88","name":"gym back door left open","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"gym back door left","payload":"open","payloadType":"str","x":170,"y":300,"wires":[["ebe70eb3bfe15eeb"]]},{"id":"0794bc9e30ea9991","type":"inject","z":"397c2f459ec16f88","name":"gym back door left closed","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"gym back door left","payload":"closed","payloadType":"str","x":170,"y":340,"wires":[["ebe70eb3bfe15eeb"]]},{"id":"a8ae0244601876fb","type":"inject","z":"397c2f459ec16f88","name":"gym back door right open","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"gym back door right","payload":"open","payloadType":"str","x":170,"y":400,"wires":[["ebe70eb3bfe15eeb"]]},{"id":"e7886559a21e6046","type":"inject","z":"397c2f459ec16f88","name":"gym back door right closed","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"gym back door right","payload":"closed","payloadType":"str","x":170,"y":440,"wires":[["ebe70eb3bfe15eeb"]]},{"id":"801517e98c9ba6fa","type":"inject","z":"397c2f459ec16f88","name":" jarvis door unlocked","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":" jarvis door","payload":"unlocked","payloadType":"str","x":150,"y":500,"wires":[["ebe70eb3bfe15eeb"]]},{"id":"153ce5f9350b6398","type":"inject","z":"397c2f459ec16f88","name":" jarvis door locked","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":" jarvis door","payload":"locked","payloadType":"str","x":140,"y":540,"wires":[["ebe70eb3bfe15eeb"]]},{"id":"feb31e1bca38aa94","type":"inject","z":"397c2f459ec16f88","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"doors","payloadType":"global","x":170,"y":120,"wires":[["b554871717464e74"]]},{"id":"ebe70eb3bfe15eeb","type":"link call","z":"397c2f459ec16f88","name":"Set status in global","links":["d40b527dcbde48df"],"timeout":"30","x":530,"y":340,"wires":[["a8f6c839a13a0c28"]]},{"id":"d40b527dcbde48df","type":"link in","z":"397c2f459ec16f88","name":"Set Status","links":[],"x":380,"y":480,"wires":[["252d653f926ccff9"]],"l":true},{"id":"ca2a8928d1fe6ca8","type":"link out","z":"397c2f459ec16f88","name":"return","mode":"return","links":[],"x":830,"y":480,"wires":[],"l":true},{"id":"252d653f926ccff9","type":"function","z":"397c2f459ec16f88","name":"","func":"// get the global 'doors' object or itinilize it if it doesn't exist\nlet doors = global.get('doors') || {}\n\n// get the door name from msg.topic\nlet door_name = msg.topic\n\n// get this doors object of initilize it\n//let this_door = doors.door_name ||{'name': msg.topic, 'status': msg.payload}\nlet this_door = doors.door_name ||{'status': msg.payload}\n\n// check the door status and set it in teh objct\nif ( (msg.payload == 'open') || (msg.payload == 'unlocked') ) {\n this_door.state = 0\n this_door.status = msg.payload\n} else if ( (msg.payload == 'closed') || (msg.payload == 'locked') ) {\n this_door.state = 1 \n this_door.status = msg.payload\n} else {\n // an unknown status has arrived - send a warning\n node.warn('unknown status for '+ msg.topic)\n return null\n}\n\n// update the 'doors' variable\ndoors[door_name] = this_door\n// update the 'doors' global\nglobal.set('doors', doors)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":480,"wires":[["ca2a8928d1fe6ca8"]]},{"id":"a8f6c839a13a0c28","type":"debug","z":"397c2f459ec16f88","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":340,"wires":[]},{"id":"3c5671db2c18c284","type":"debug","z":"397c2f459ec16f88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":790,"y":120,"wires":[]},{"id":"ddd7971942421d43","type":"comment","z":"397c2f459ec16f88","name":"This flow runs at a set interval and checks to sse that all doors are locked/closed ","info":"","x":430,"y":60,"wires":[]},{"id":"ab37f81aefc3e35f","type":"comment","z":"397c2f459ec16f88","name":"'Set Status' This flow sets the global with the status of each door ","info":"","x":660,"y":420,"wires":[]},{"id":"51b224860c6ee555","type":"comment","z":"397c2f459ec16f88","name":"This flow takes the input status of the doors and calls the 'Set Status' flow","info":"","x":710,"y":260,"wires":[]},{"id":"b554871717464e74","type":"function","z":"397c2f459ec16f88","name":"","func":"function delay(time) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\n\n\nconst doors = msg.payload\nmsg.payload = \"system secure\"\n\nfor (let key in doors) {\n// node.warn(\"processing\" key);\n// node.warn(\"door: \" + key + \" state=\" + doors[key][\"state\"]);\n if (doors[key][\"state\"] == 0) {\n msg.payload = \"security breach: \"+ key;\n node.send(msg);\n }\n}\n\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":120,"wires":[["3c5671db2c18c284"]]}]