Simple flow but not reliable

Hi,

I created a flow which is triggered if a window is opened, after 5 minutes I want to have a reminder through an amazon echo that the window should be closed. If not closed within 2 minutes there should be a second message, every 2 minutes it should be checked if the window is still open and then fire the notification. If closed within the first 5 minutes or later the flow should be stopped.

When testing the flow works fine, but when set in action it fails in 80% of the cases. I get first notification but then the stoptimer for the next check after 2 minutes doesn't get enabled.
I can't find the failure, also it sometimes work as expected.

What am I missing?

[{"id":"e6b7e007.878fa8","type":"server-state-changed","z":"14d4946d.833e9c","name":"Badfenster lueften","server":"a68d7d60.2c7d7","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.window_aqa17","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,"x":130,"y":120,"wires":[["29b63324.9d6c5c"]]},{"id":"29b63324.9d6c5c","type":"switch","z":"14d4946d.833e9c","name":"offen oder zu","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":120,"wires":[["f8e43b53.486478"],["d0e59c7f.19f158"]]},{"id":"86cbd389.dc9c5","type":"stoptimer","z":"14d4946d.833e9c","duration":"2","units":"Minute","payloadtype":"num","payloadval":"0","name":"Erinnerung 2 Minuten","x":680,"y":240,"wires":[["2ae88b9c.fca7d4"],[]]},{"id":"d0e59c7f.19f158","type":"change","z":"14d4946d.833e9c","name":"Timer STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":240,"wires":[["86cbd389.dc9c5"]]},{"id":"6ff6fb9b.c499ac","type":"api-current-state","z":"14d4946d.833e9c","name":"Status Badfenster","server":"a68d7d60.2c7d7","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.window_aqa17","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":770,"y":120,"wires":[["8acc723f.c28548"],[]]},{"id":"8acc723f.c28548","type":"alexa-remote-routine","z":"14d4946d.833e9c","name":"Benachrichtigung EG","account":"6bcdcff1.67ded","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"str","value":"Das Badfenster kann wieder geschlossen werden"},"devices":["8a5c53101475429dbcd9c02ceba2bcc4"]}},"x":1020,"y":120,"wires":[["86cbd389.dc9c5"]]},{"id":"2ae88b9c.fca7d4","type":"alexa-remote-routine","z":"14d4946d.833e9c","name":"Erinnerung EG","account":"6bcdcff1.67ded","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"str","value":"Bitte das Badfenster schliessen"},"devices":["8a5c53101475429dbcd9c02ceba2bcc4"]}},"x":680,"y":400,"wires":[["86cbd389.dc9c5"]]},{"id":"f8e43b53.486478","type":"stoptimer","z":"14d4946d.833e9c","duration":"3","units":"Minute","payloadtype":"num","payloadval":"0","name":"5 min lueften","x":550,"y":120,"wires":[["6ff6fb9b.c499ac"],[]]},{"id":"a68d7d60.2c7d7","type":"server","name":"Home Assistant","addon":true},{"id":"6bcdcff1.67ded","type":"alexa-remote-account","name":"AlexaAmazon","authMethod":"proxy","proxyOwnIp":"192.168.178.48","proxyPort":"3456","cookieFile":"","refreshInterval":"3","alexaServiceHost":"layla.amazon.de","amazonPage":"amazon.de","acceptLanguage":"de-DE","userAgent":"","useWsMqtt":"on","autoInit":"on"}]

Welcome to the forum.
It seems that your flow only includes one node. You need to select all the relevant nodes and then Export.

Yes, new to the forum and new to Node Red :upside_down_face:

Thanks Colin.

[{"id":"e6b7e007.878fa8","type":"server-state-changed","z":"14d4946d.833e9c","name":"Badfenster lueften","server":"a68d7d60.2c7d7","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.window_aqa17","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,"x":130,"y":120,"wires":[["29b63324.9d6c5c"]]},{"id":"29b63324.9d6c5c","type":"switch","z":"14d4946d.833e9c","name":"offen oder zu","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":120,"wires":[["f8e43b53.486478"],["d0e59c7f.19f158"]]},{"id":"86cbd389.dc9c5","type":"stoptimer","z":"14d4946d.833e9c","duration":"2","units":"Minute","payloadtype":"num","payloadval":"0","name":"Erinnerung 2 Minuten","x":680,"y":240,"wires":[["2ae88b9c.fca7d4"],[]]},{"id":"d0e59c7f.19f158","type":"change","z":"14d4946d.833e9c","name":"Timer STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":240,"wires":[["86cbd389.dc9c5"]]},{"id":"6ff6fb9b.c499ac","type":"api-current-state","z":"14d4946d.833e9c","name":"Status Badfenster","server":"a68d7d60.2c7d7","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.window_aqa17","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":770,"y":120,"wires":[["8acc723f.c28548"],[]]},{"id":"8acc723f.c28548","type":"alexa-remote-routine","z":"14d4946d.833e9c","name":"Benachrichtigung EG","account":"6bcdcff1.67ded","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"str","value":"Das Badfenster kann wieder geschlossen werden"},"devices":["8a5c53101475429dbcd9c02ceba2bcc4"]}},"x":1020,"y":120,"wires":[["86cbd389.dc9c5"]]},{"id":"2ae88b9c.fca7d4","type":"alexa-remote-routine","z":"14d4946d.833e9c","name":"Erinnerung EG","account":"6bcdcff1.67ded","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"str","value":"Bitte das Badfenster schliessen"},"devices":["8a5c53101475429dbcd9c02ceba2bcc4"]}},"x":680,"y":400,"wires":[["86cbd389.dc9c5"]]},{"id":"f8e43b53.486478","type":"stoptimer","z":"14d4946d.833e9c","duration":"3","units":"Minute","payloadtype":"num","payloadval":"0","name":"5 min lueften","x":550,"y":120,"wires":[["6ff6fb9b.c499ac"],[]]},{"id":"a68d7d60.2c7d7","type":"server","name":"Home Assistant","addon":true},{"id":"6bcdcff1.67ded","type":"alexa-remote-account","name":"AlexaAmazon","authMethod":"proxy","proxyOwnIp":"192.168.178.48","proxyPort":"3456","cookieFile":"","refreshInterval":"3","alexaServiceHost":"layla.amazon.de","amazonPage":"amazon.de","acceptLanguage":"de-DE","userAgent":"","useWsMqtt":"on","autoInit":"on"}]

Try something like this, not sure which phrase you want, so you may need to reverse them, the spoken words are set in trigger and change node.

[{"id":"57675e72.26a0d8","type":"tab","label":"Flow 6","disabled":false,"info":""},{"id":"918cdfc.bbfc5a","type":"function","z":"57675e72.26a0d8","name":"propagate","func":"let dimmers = [\"dimmer1\",\"dimmer2\",\"dimmer3\"];\nlet sender = msg.topic.split(\"/\")[2];\nfor(let i = 0; i < dimmers.length; i++ ){\n    if(dimmers[i] !== sender && !msg.payload.sender){\n        node.send({\"payload\":{\"bri\":msg.payload.bri, \"sender\": true},\n        topic:`cmnd/lighting/${dimmers[i]}/dimmer`});\n    }\n}\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":430,"y":140,"wires":[["c45dd6b4.1fce4"]]},{"id":"c444b383.2601a8","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stat/lighting/dimmer3/RESULT","payload":"{\"bri\":10,\"sender\":true}","payloadType":"json","x":190,"y":160,"wires":[["918cdfc.bbfc5a"]]},{"id":"d81e8ecc.765628","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stat/lighting/dimmer2/RESULT","payload":"{\"bri\":80}","payloadType":"json","x":200,"y":120,"wires":[["918cdfc.bbfc5a"]]},{"id":"d3c01d6e.c7aaf","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stat/lighting/dimmer1/RESULT","payload":"{\"bri\":40}","payloadType":"json","x":200,"y":80,"wires":[["918cdfc.bbfc5a"]]},{"id":"ae9a5160.f49ff","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stat/lighting/dimmer4/RESULT","payload":"{\"bri\":100}","payloadType":"json","x":80,"y":200,"wires":[[]]},{"id":"23aa6168.533326","type":"debug","z":"57675e72.26a0d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":140,"wires":[]},{"id":"c45dd6b4.1fce4","type":"delay","z":"57675e72.26a0d8","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":480,"y":200,"wires":[["71b4d027.1dd54"]]},{"id":"71b4d027.1dd54","type":"function","z":"57675e72.26a0d8","name":"simulate mqtt result","func":"const item = msg.topic.split(\"/\")[2];\nmsg.topic = `stat/lighting/${item}/RESULT`;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":200,"wires":[["23aa6168.533326","918cdfc.bbfc5a"]]},{"id":"b8db2d9c.ebd32","type":"debug","z":"57675e72.26a0d8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":550,"y":600,"wires":[]},{"id":"4dc8f036.026c9","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/lights/dimmer2/Dimmer","payload":"70","payloadType":"num","x":250,"y":280,"wires":[["2ff17866.86033"]]},{"id":"2ff17866.86033","type":"mqtt out","z":"57675e72.26a0d8","name":"","topic":"","qos":"","retain":"","broker":"e8ba3ef5.22f4a8","x":650,"y":360,"wires":[]},{"id":"4268b7a3.be459","type":"mqtt in","z":"57675e72.26a0d8","name":"","topic":"stat/lights/+/DIMMER","qos":"0","datatype":"json","broker":"e8ba3ef5.22f4a8","x":160,"y":360,"wires":[["3cb38782.b1b66","f46ba057.e03eb8"]]},{"id":"2a10f15b.f1cd2e","type":"function","z":"57675e72.26a0d8","name":"","func":"let dimmers = [\"dimmer1\",\"dimmer2\",\"dimmer3\"];\nlet sender = msg.topic.split(\"/\")[2];\nlet send = {};\nfor(let i = 0; i < dimmers.length; i++ ){\n    if(dimmers[i] !== sender && !msg.retain){\n        send = {\"payload\":Number(msg.payload), \"retain\": true,\n        topic:`cmnd/lights/${dimmers[i]}/Dimmer`}\n        node.send(send);\n    }\n    \n//send[i] = null;\n}\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390,"y":360,"wires":[[]]},{"id":"3cb38782.b1b66","type":"delay","z":"57675e72.26a0d8","name":"","pauseType":"delay","timeout":"3000","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":270,"y":420,"wires":[["2a10f15b.f1cd2e"]]},{"id":"82294919.b120a","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/lights/dimmer1/Dimmer","payload":"30","payloadType":"num","x":250,"y":240,"wires":[["2ff17866.86033"]]},{"id":"9c0025e9.86ffe8","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/lights/dimmer3/Dimmer","payload":"0","payloadType":"num","x":240,"y":320,"wires":[["2ff17866.86033"]]},{"id":"f46ba057.e03eb8","type":"debug","z":"57675e72.26a0d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload & \" | \" & retained","statusType":"jsonata","x":490,"y":420,"wires":[]},{"id":"9d9cde6d.b99838","type":"mqtt in","z":"57675e72.26a0d8","name":"","topic":"cmnd/lights/+/Dimmer","qos":"2","datatype":"json","broker":"e8ba3ef5.22f4a8","x":190,"y":640,"wires":[["b8db2d9c.ebd32","1932f9a3.2d7cf6"]]},{"id":"294cb5d8.187b82","type":"mqtt out","z":"57675e72.26a0d8","name":"","topic":"","qos":"","retain":"","broker":"e8ba3ef5.22f4a8","x":570,"y":640,"wires":[]},{"id":"1932f9a3.2d7cf6","type":"function","z":"57675e72.26a0d8","name":"","func":"msg.topic = `stat/lights/${msg.topic.split(\"/\")[2]}/DIMMER`\n//msg.retain= true;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":420,"y":640,"wires":[["294cb5d8.187b82","b8db2d9c.ebd32"]]},{"id":"e92401aa.c1c7e","type":"inject","z":"57675e72.26a0d8","name":"100","props":[{"p":"payload.openPercent","v":"100","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":860,"wires":[["fdc0d58.4081c28"]]},{"id":"711aea43.2409bc","type":"inject","z":"57675e72.26a0d8","name":"0","props":[{"p":"payload.openPercent","v":"0","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":920,"wires":[["fdc0d58.4081c28"]]},{"id":"5c0b832f.0ec19c","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"retain","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stat/lights/dimmer3/DIMMER","payload":"0","payloadType":"num","x":380,"y":540,"wires":[["294cb5d8.187b82"]]},{"id":"fdc0d58.4081c28","type":"change","z":"57675e72.26a0d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.openPercent > 0 ? true : false","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":880,"wires":[["b84dcbfc.816ad"]]},{"id":"b84dcbfc.816ad","type":"debug","z":"57675e72.26a0d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":900,"wires":[]},{"id":"eb4e3876.e93928","type":"switch","z":"57675e72.26a0d8","name":"offen oder zu","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":1100,"wires":[["7406465e.5e7f58"],["66f68d39.3792c4"]]},{"id":"66f68d39.3792c4","type":"change","z":"57675e72.26a0d8","name":"Timer STOP","rules":[{"t":"set","p":"reset","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":1160,"wires":[["583d59e1.86e28","7406465e.5e7f58"]]},{"id":"a049214f.b74cb","type":"alexa-remote-routine","z":"57675e72.26a0d8","name":"Benachrichtigung EG","account":"b0877f3.836aa","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"msg","value":"payload"},"devices":["G090LF1182850C6D"]}},"x":1000,"y":1140,"wires":[[]]},{"id":"58e7c63a.e7634","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":170,"y":1080,"wires":[["eb4e3876.e93928"]]},{"id":"62274f0a.c715","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":160,"y":1140,"wires":[["eb4e3876.e93928"]]},{"id":"583d59e1.86e28","type":"trigger","z":"57675e72.26a0d8","name":"","op1":"Das Badfenster kann wieder geschlossen werden","op2":"","op1type":"str","op2type":"str","duration":"-120","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":750,"y":1100,"wires":[["a049214f.b74cb"]]},{"id":"7406465e.5e7f58","type":"delay","z":"57675e72.26a0d8","name":"","pauseType":"delay","timeout":"300","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":520,"y":1060,"wires":[["583d59e1.86e28","30154867.5b77e"]]},{"id":"30154867.5b77e","type":"change","z":"57675e72.26a0d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Bitte das Badfenster schliessen","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":1140,"wires":[["a049214f.b74cb"]]},{"id":"e8ba3ef5.22f4a8","type":"mqtt-broker","z":"","name":"testb","broker":"192.168.1.25","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b0877f3.836aa","type":"alexa-remote-account","z":"","name":"alexaremote2","authMethod":"proxy","proxyOwnIp":"192.168.1.25","proxyPort":"3456","cookieFile":"alexa-remote2.txt","refreshInterval":"14","alexaServiceHost":"layla.amazon.co.uk","amazonPage":"amazon.co.uk","acceptLanguage":"en-UK","userAgent":"","useWsMqtt":"on","autoInit":"off"}]

Nice, it's working fine. I need to understand the differences to my setup and why mine wasn't working reliable.

Thanks
Nikki

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.