Is possible have Multiple Window Sensors recurrent alerts with one Wait Until node?

Hi everybody,
I’ve created a flow that sends me an alerts every n minutes (were n increases each loop of a 2 factor) when a specific window is opened. It works.
Now I’d like to use only one trigger to start the flow for every window, is this possible? Right now I’m stuck since the second window overwrite the previous timer loop. There’s a way to set it to work separately?
thanks,

here the flow that counts among others, a trigger-state, then a ha-wait-until, a function and again a ha-wait-until:


here the conf of one of the ha-wait-until.
image

No, but you can use a trigger node and reset that using the second output of the trigger-state node.

maybe I’m wrong but it to me it seems that kermit’s answer is not what op is asking for (or wants to ask :wink: )

IMO OP wants to reuse his implementation for several windows. If so, then answer is: it is possible with use of subflows. Just create subflow which provide needed logic. In result you will get new node you can use in your flows.
Then connect each window trigger with separate instances of subflow

[{"id":"cff1ba06.74d7d8","type":"server-state-changed","z":"f61766ce.f85398","name":"","server":"","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.window.*","entityidfiltertype":"regex","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":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":194,"y":4368,"wires":[["e591a492.68ac98"],["e591a492.68ac98","1861b9bd.7c8066"]]},{"id":"e591a492.68ac98","type":"trigger","z":"f61766ce.f85398","name":"initial timer","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"20","extend":true,"overrideDelay":false,"units":"s","reset":"off","bytopic":"topic","topic":"topic","outputs":1,"x":438,"y":4416,"wires":[["6dbb7755.4408b8"]]},{"id":"1861b9bd.7c8066","type":"trigger","z":"f61766ce.f85398","name":"loop timer","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"60","extend":true,"overrideDelay":false,"units":"s","reset":"off","bytopic":"topic","topic":"topic","outputs":1,"x":620,"y":4368,"wires":[["6dbb7755.4408b8"]]},{"id":"6dbb7755.4408b8","type":"function","z":"f61766ce.f85398","name":"msg telegram","func":"\nreturn msg;","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":4416,"wires":[["d9ea142d.c55918"],[]]},{"id":"d9ea142d.c55918","type":"function","z":"f61766ce.f85398","name":"set mins * 2","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":822,"y":4416,"wires":[["1861b9bd.7c8066"]]}]
2 Likes

oh, thanks, I’ll try it tomorrow morning for sure. I tried trigger before, but since I’m not very familiar with it I didn’t go far.
Meanwhile I’ve tried using a while-loop+delay node and I was so close to have the flow done, but there are a lot of corners to round about resets before getting there that the flow would be too complex to be worth it.

I tried it and it works perfectly, thanks Kermit. I just checked the override delay flag to enable it and it works as I wanted.

I also changed the HA trigger with the event state node with entity “substring” option selected, just to be sure.

[{"id":"53314303.8aab1c","type":"server-state-changed","z":"3c65bbf1.a7e964","name":"Finestre Aperte","server":"","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.00000000_contact,binary_sensor.0x000000_contact","entityidfiltertype":"substring","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":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":180,"y":120,"wires":[["9406252f.410bf8"],["9406252f.410bf8","dd01ca42.a73148"]]},{"id":"dd01ca42.a73148","type":"trigger","z":"3c65bbf1.a7e964","name":"loop timer","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"60","extend":true,"overrideDelay":true,"units":"s","reset":"off","bytopic":"topic","topic":"topic","outputs":1,"x":460,"y":240,"wires":[["262d7d5d.8c5b22"]]},{"id":"9406252f.410bf8","type":"trigger","z":"3c65bbf1.a7e964","name":"initial timer","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"1","extend":true,"overrideDelay":false,"units":"min","reset":"off","bytopic":"topic","topic":"topic","outputs":1,"x":450,"y":100,"wires":[["262d7d5d.8c5b22"]]},{"id":"262d7d5d.8c5b22","type":"function","z":"3c65bbf1.a7e964","name":"msg telegram","func":"msg.counter=(typeof msg.counter == 'undefined')?1:msg.counter+1;\nmsg.delay=(typeof msg.delay == 'undefined')?2*1000*60:msg.delay*2;\nmsg.elapsed_time=Math.round(\n                 (Date.parse(new Date())\n                  -Date.parse(new Date(msg.data.new_state.last_changed)))\n                  /(1000*60)\n                 );\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":160,"wires":[["dd01ca42.a73148","646792c9.6432dc"]]},{"id":"646792c9.6432dc","type":"debug","z":"3c65bbf1.a7e964","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"elapsed_time","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":160,"wires":[]}]