@E1cid
I'm using your clever flow to monitor several window and door contact sensors. If they switch to a new state for longer than 30 seconds, then Alexa announces that the specific door or window sensor is open or closed. I was using a couple of trigger nodes and reset nodes (see below) and that worked great, except it would ultimately always make an announcement of some sort.
[{"id":"c3ff746c4dd5d8a3","type":"group","z":"b5a44a6b8fa524cc","style":{"stroke":"#2b2b2b","stroke-opacity":"1","fill":"#181818","fill-opacity":"0.5","label":true,"label-position":"nw","color":"#cccccc"},"nodes":["3a2d7a1c82fdcead","6bc937df4c81a157","fe8e5cd980ce8d89","4b50fa847e306f12","36ca26d642338046","9930e99214c0ce15","02d661c3d89456ef","ec8563aa69a61bbd","eb16e8047bf1330f"],"x":734,"y":3799,"w":892,"h":222},{"id":"3a2d7a1c82fdcead","type":"trigger","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","name":"30 seconds","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"30","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1235,"y":3840,"wires":[["02d661c3d89456ef"]],"icon":"node-red-contrib-bigtimer/timer.png","l":false},{"id":"6bc937df4c81a157","type":"switch","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","name":"Open/Closed","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"open","vt":"str"},{"t":"eq","v":"closed","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":990,"y":3900,"wires":[["3a2d7a1c82fdcead","4b50fa847e306f12"],["36ca26d642338046","fe8e5cd980ce8d89"]]},{"id":"fe8e5cd980ce8d89","type":"change","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","name":"RESET","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1235,"y":3880,"wires":[["3a2d7a1c82fdcead"]],"icon":"font-awesome/fa-refresh","l":false},{"id":"4b50fa847e306f12","type":"change","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","name":"RESET","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1235,"y":3940,"wires":[["36ca26d642338046"]],"icon":"font-awesome/fa-refresh","l":false},{"id":"36ca26d642338046","type":"trigger","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","name":"30 seconds","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"30","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1235,"y":3980,"wires":[["02d661c3d89456ef"]],"icon":"node-red-contrib-bigtimer/timer.png","l":false},{"id":"9930e99214c0ce15","type":"debug","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1530,"y":3940,"wires":[]},{"id":"02d661c3d89456ef","type":"junction","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","x":1400,"y":3900,"wires":[["9930e99214c0ce15","eb16e8047bf1330f"]]},{"id":"ec8563aa69a61bbd","type":"no-op","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","name":"Input","x":810,"y":3900,"wires":[["6bc937df4c81a157"]]},{"id":"eb16e8047bf1330f","type":"no-op","z":"b5a44a6b8fa524cc","g":"c3ff746c4dd5d8a3","name":"Output","x":1540,"y":3860,"wires":[[]]}]
With your solution I can suppress the voice response completely if, for example, I open and close the door quickly <30 seconds. I put it all in a sub flow (attached below) that works perfectly for my application, so thank you for that!
[{"id":"fcf98f412ee79100","type":"subflow","name":"flow.time","info":"","category":"","in":[{"x":160,"y":380,"wires":[{"id":"15f35af014d11b59"}]}],"out":[{"x":1260,"y":380,"wires":[{"id":"79dfadac8f91a73e","port":0}]}],"env":[],"meta":{},"color":"#C0DEED","icon":"node-red-contrib-sun-position/clock-timer-black.svg","status":{"x":500,"y":200,"wires":[{"id":"9f9bf40dd470511a","port":0}]}},{"id":"79dfadac8f91a73e","type":"junction","z":"fcf98f412ee79100","x":1180,"y":380,"wires":[[]]},{"id":"4e75361f0a901ccc","type":"junction","z":"fcf98f412ee79100","x":560,"y":440,"wires":[["fbd7f895fc7d1649","1a34d71f5baa7435"]]},{"id":"6eae251ab423fbd6","type":"junction","z":"fcf98f412ee79100","x":560,"y":320,"wires":[["fbd7f895fc7d1649","5403d70877f4991b"]]},{"id":"843d83cf9799160b","type":"junction","z":"fcf98f412ee79100","x":1000,"y":380,"wires":[["051a4af02423a941"]]},{"id":"5403d70877f4991b","type":"junction","z":"fcf98f412ee79100","x":920,"y":320,"wires":[["843d83cf9799160b"]]},{"id":"1a34d71f5baa7435","type":"junction","z":"fcf98f412ee79100","x":920,"y":440,"wires":[["843d83cf9799160b"]]},{"id":"15f35af014d11b59","type":"switch","z":"fcf98f412ee79100","name":"Open/Closed","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"open","vt":"str"},{"t":"eq","v":"closed","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":320,"y":380,"wires":[["6eae251ab423fbd6"],["4e75361f0a901ccc"]]},{"id":"fbd7f895fc7d1649","type":"switch","z":"fcf98f412ee79100","name":"","property":"time","propertyType":"flow","rules":[{"t":"jsonata_exp","v":"$millis() - $flowContext(\"time\") < 30000","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":635,"y":380,"wires":[["aae3bc4e29be85e9"],["64787c1de8b159bf"]],"l":false},{"id":"64787c1de8b159bf","type":"change","z":"fcf98f412ee79100","name":"","rules":[{"t":"set","p":"time","pt":"flow","to":"$millis()","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":400,"wires":[[]]},{"id":"aae3bc4e29be85e9","type":"change","z":"fcf98f412ee79100","name":"","rules":[{"t":"set","p":"time","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"topic","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":360,"wires":[["2b2e6fdcc5ce87e3"]]},{"id":"9f9bf40dd470511a","type":"status","z":"fcf98f412ee79100","name":"","scope":["051a4af02423a941"],"x":220,"y":200,"wires":[[]]},{"id":"051a4af02423a941","type":"trigger","z":"fcf98f412ee79100","name":"31 seconds","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"31","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"topic","topic":"topic","outputs":1,"x":1095,"y":380,"wires":[["79dfadac8f91a73e"]],"icon":"node-red-contrib-bigtimer/timer.png","l":false},{"id":"2b2e6fdcc5ce87e3","type":"change","z":"fcf98f412ee79100","name":"RESET","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":905,"y":380,"wires":[["843d83cf9799160b"]],"icon":"font-awesome/fa-refresh","l":false}]
Now, me being the curious sort that I am and you being the clever sort that you are, made me wonder if there is an easy way to make this work based on topic. Basically, instead of putting the subflow node after every sensor node, I'm wondering if there is a way to just wire all of the sensor nodes to one subflow node and have it keep track based on topic. (Currently, if I were to do that and, for example, open all of my windows, it would just skip every other window.)
In my brain, it seems like it should be doable, but I'd likely make it much more complex than it's worth.
Cheers,
Rich