Limitations on input wires in Node-RED?

I’ve recently started using Node-RED for automations in my Hass.io system. And currently I’m trying to handle automatically closing the garage door if it’s left open for too long. I’m using an Aeotec Garage Door Controller which outputs “opening”, “open”, “closing” and “closed” depending on action.

What I want is to have a five minute timer when the garage door opens. Then I push out a HTML5 notification saying the door is open and will be closed in a couple of minutes, where I can postpone the automatic closing for 5 or 30 minutes (or just dismiss the notification. All this is done with four stoptimer nodes.

Of course I need to stop the stoptimer nodes if the door is manually closed, so therefore I’ve wired multiple wires to the input on the stoptimers. But is this a problem?

Here’s where I am now. In this flow the uppermost timer is the first timer started by an “opening” or “open” message. A “closing” or “close” message stops it (the change node converts the payload to “STOP”). After the timer runs out (garage door left open for too long), a notification is sent out and the second timer should be started (giving me time to postpone closing or dismiss notification). But the second timer should stop either by a “closing” or “close” message or by a “postpone” action.

My problem is that the second stoptimer isn’t even starting when those two change node outputs are connected to it. Remove those wires and the second timer starts as the first timer finishes.

What could be the problem here?

The number of input shouldn’t matter. It’s sort of hard to debug the exact issue without having an export of the flow but I did a mock of one that seems to be working correctly. It uses trigger nodes instead of stop timer nodes.

[{"id":"3e2008d6.714128","type":"trigger-state","z":"5eb3594f.d294b8","name":"","server":"ef067c6f.620e6","entityid":"test","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":4,"customoutputs":[{"outputId":"rxn89uqcjgs","messageType":"default","messageValue":"","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"includes","comparatorValue":"opening,open"},{"outputId":"bj2f07ky2v","messageType":"custom","messageValue":"{\"reset\": true}","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"includes","comparatorValue":"closing,closed"}],"outputinitially":false,"state_type":"str","x":394,"y":1280,"wires":[[],[],["967ae17f.3b4d9"],["967ae17f.3b4d9","66bf5a33.fd8624","ede3baba.8a5a48"]]},{"id":"c065b7da.a4e878","type":"inject","z":"5eb3594f.d294b8","name":"open","topic":"","payload":"{\"entity_id\":\"test\",\"new_state\":{\"state\":\"open\"},\"old_state\":{\"state\":\"on\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":162,"y":1200,"wires":[["3e2008d6.714128"]]},{"id":"e977a62e.7b54b8","type":"debug","z":"5eb3594f.d294b8","name":"Notify","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":738,"y":1264,"wires":[]},{"id":"967ae17f.3b4d9","type":"trigger","z":"5eb3594f.d294b8","op1":"","op2":"original delay","op1type":"nul","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":588,"y":1264,"wires":[["66bf5a33.fd8624","e977a62e.7b54b8"]]},{"id":"66bf5a33.fd8624","type":"trigger","z":"5eb3594f.d294b8","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"delay 5 mins","x":758,"y":1312,"wires":[["6b482337.b077dc"]]},{"id":"6b482337.b077dc","type":"debug","z":"5eb3594f.d294b8","name":"Close Door","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":950,"y":1312,"wires":[]},{"id":"ec9c007.6eb6","type":"inject","z":"5eb3594f.d294b8","name":"opening","topic":"","payload":"{\"entity_id\":\"test\",\"new_state\":{\"state\":\"opening\"},\"old_state\":{\"state\":\"on\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":158,"y":1152,"wires":[["3e2008d6.714128"]]},{"id":"2a394aa0.46fd86","type":"inject","z":"5eb3594f.d294b8","name":"closing","topic":"","payload":"{\"entity_id\":\"test\",\"new_state\":{\"state\":\"closed\"},\"old_state\":{\"state\":\"closing\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":158,"y":1248,"wires":[["3e2008d6.714128"]]},{"id":"c63c6fc5.d3b1e","type":"inject","z":"5eb3594f.d294b8","name":"closed","topic":"","payload":"{\"entity_id\":\"test\",\"new_state\":{\"state\":\"closed\"},\"old_state\":{\"state\":\"on\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":158,"y":1296,"wires":[["3e2008d6.714128"]]},{"id":"bcf868a2.3d7f28","type":"switch","z":"5eb3594f.d294b8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"delay 5","vt":"str"},{"t":"eq","v":"delay 30","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":354,"y":1360,"wires":[["66bf5a33.fd8624"],["5f707e1f.aed79","ede3baba.8a5a48"]]},{"id":"bf58f18b.7a3e5","type":"inject","z":"5eb3594f.d294b8","name":"delay 5","topic":"","payload":"delay 5","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":162,"y":1360,"wires":[["bcf868a2.3d7f28"]]},{"id":"efaf83d8.2e869","type":"inject","z":"5eb3594f.d294b8","name":"delay 30","topic":"","payload":"delay 30","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":172,"y":1408,"wires":[["bcf868a2.3d7f28"]]},{"id":"5f707e1f.aed79","type":"change","z":"5eb3594f.d294b8","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":482,"y":1392,"wires":[["66bf5a33.fd8624"]]},{"id":"ede3baba.8a5a48","type":"trigger","z":"5eb3594f.d294b8","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":false,"units":"s","reset":"","bytopic":"all","name":"delay 30 mins","x":768,"y":1360,"wires":[["6b482337.b077dc"]]}]

Thanks for the tip about the trigger node. Might be that this is better to use for my purpose.

I will try to modify my code accordingly, but here’s the code that has been failing. I can’t see where I’m going wrong here, so if you can take a look it’d be great.

[{"id":"db3820f6.08121","type":"api-call-service","z":"80fa73c2.63569","name":"","server":"e19c43d0.f9546","service_domain":"notify","service":"html5_oystein_laptop_work","data":"{\"message\":\"Garasjeporten er åpen, og blir stengt om to minutter.\",\"data\":{\"tag\":\"garage_door_open\",\"actions\":[{\"action\":\"postpone5\",\"title\":\"Utsett 5 minutter\"},{\"action\":\"postpone30\",\"title\":\"Utsett 30 minutter\"}]}}","render_data":true,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":1390,"y":260,"wires":[[]]},{"id":"91e1d9a1.96c618","type":"server-events","z":"80fa73c2.63569","name":"","server":"e19c43d0.f9546","event_type":"html5_notification.clicked","x":170,"y":500,"wires":[["7561b427.90fddc"]]},{"id":"702742df.ad131c","type":"server-state-changed","z":"80fa73c2.63569","name":"","server":"e19c43d0.f9546","entityidfilter":"cover.garage_door_controller_barrier_state_label","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"x":270,"y":260,"wires":[[]]},{"id":"709b0e1d.cee9","type":"inject","z":"80fa73c2.63569","name":"","topic":"","payload":"opening","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":300,"wires":[["c0f34d3f.0dd81"]]},{"id":"798acf0c.12895","type":"inject","z":"80fa73c2.63569","name":"","topic":"","payload":"open","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":340,"wires":[["c0f34d3f.0dd81"]]},{"id":"ee51bb11.0393b8","type":"stoptimer","z":"80fa73c2.63569","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1040,"y":240,"wires":[["db3820f6.08121","de1ebbac.6813a8","9ae534a9.e5cb38"],[]]},{"id":"7e4b29ed.c6b018","type":"inject","z":"80fa73c2.63569","name":"","topic":"","payload":"closing","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":380,"wires":[["c0f34d3f.0dd81"]]},{"id":"2232f852.97ae48","type":"inject","z":"80fa73c2.63569","name":"","topic":"","payload":"closed","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":420,"wires":[["c0f34d3f.0dd81"]]},{"id":"9ae534a9.e5cb38","type":"api-call-service","z":"80fa73c2.63569","name":"","server":"e19c43d0.f9546","service_domain":"notify","service":"html5_oystein_phone","data":"{\"message\":\"Garasjeporten er åpen, og blir stengt om to minutter.\",\"data\":{\"tag\":\"garage_door_open\",\"actions\":[{\"action\":\"postpone5\",\"title\":\"Utsett 5 minutter\"},{\"action\":\"postpone30\",\"title\":\"Utsett 30 minutter\"}]}}","render_data":true,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":1370,"y":180,"wires":[[]]},{"id":"de1ebbac.6813a8","type":"stoptimer","z":"80fa73c2.63569","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1320,"y":340,"wires":[["8a31bb2e.f36228"],[]]},{"id":"7561b427.90fddc","type":"switch","z":"80fa73c2.63569","name":"","property":"payload.event.action","propertyType":"msg","rules":[{"t":"eq","v":"postpone5","vt":"str"},{"t":"eq","v":"postpone30","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":3,"x":390,"y":500,"wires":[["c460393a.c00db8","7efe413c.32629"],["fb0ec758.5e3db8","7efe413c.32629"],[]]},{"id":"c460393a.c00db8","type":"stoptimer","z":"80fa73c2.63569","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1040,"y":440,"wires":[["de1ebbac.6813a8","9ae534a9.e5cb38","db3820f6.08121"],[]]},{"id":"fb0ec758.5e3db8","type":"stoptimer","z":"80fa73c2.63569","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1040,"y":500,"wires":[["de1ebbac.6813a8","9ae534a9.e5cb38","db3820f6.08121"],[]]},{"id":"c0f34d3f.0dd81","type":"switch","z":"80fa73c2.63569","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"opening","vt":"str"},{"t":"eq","v":"open","vt":"str"},{"t":"eq","v":"closing","vt":"str"},{"t":"eq","v":"closed","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":630,"y":260,"wires":[["ee51bb11.0393b8"],["ee51bb11.0393b8"],["17be1ec0.206991"],["17be1ec0.206991"]]},{"id":"17be1ec0.206991","type":"change","z":"80fa73c2.63569","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":280,"wires":[["c460393a.c00db8","ee51bb11.0393b8","fb0ec758.5e3db8","de1ebbac.6813a8"]]},{"id":"8a31bb2e.f36228","type":"debug","z":"80fa73c2.63569","name":"close_door","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1530,"y":340,"wires":[]},{"id":"7efe413c.32629","type":"change","z":"80fa73c2.63569","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":340,"wires":[["de1ebbac.6813a8"]]},{"id":"e19c43d0.f9546","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"}]

This sounds similar to an issue I’ve been having with stoptimer

The flow below demonstrates the issue I’m having.
If I inject a timestamp using the first inject node, all works as expected.
If I inject a timestamp and then stop the timers using the second inject node before timer2 starts and then restart timer1, timer2 never starts.
From my reading of the documentation, timer2 should start as soon as it receives a new payload that isn’t ‘stop’.


[{"id":"926a79fb.5e63c8","type":"stoptimer","z":"d8ad8b8f.76e598","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"Timer2 - 5 secs","x":520,"y":280,"wires":[["5203e4c3.67dcdc"],[]]}]

Yeah, I just looked through the source and found the bug when chaining two stoptimers in a row. I can’t seem to find a repo for it anywhere to report it. A simple solution I found was to add a change node between the two stoptimer nodes and delete msg._timerpass. Like in my example above you could just use trigger nodes as the pretty much do the same thing just without the second output.

[{"id":"1ada5802.41ac68","type":"inject","z":"5eb3594f.d294b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":172,"y":976,"wires":[["291882a6.e77cde"]]},{"id":"f10ddba3.5d5468","type":"inject","z":"5eb3594f.d294b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":172,"y":1072,"wires":[["ff636229.69c55"]]},{"id":"ff636229.69c55","type":"change","z":"5eb3594f.d294b8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":348,"y":1072,"wires":[["291882a6.e77cde","2a38130d.7c68ec"]]},{"id":"291882a6.e77cde","type":"stoptimer","z":"5eb3594f.d294b8","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":576,"y":976,"wires":[["3c5f847f.c1c90c","26f4b219.ed7a4e"],[]]},{"id":"2a38130d.7c68ec","type":"stoptimer","z":"5eb3594f.d294b8","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":576,"y":1072,"wires":[["c013fbad.28bbc8"],["db6f873c.9c8558"]]},{"id":"3c5f847f.c1c90c","type":"debug","z":"5eb3594f.d294b8","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":770,"y":976,"wires":[]},{"id":"c013fbad.28bbc8","type":"debug","z":"5eb3594f.d294b8","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":770,"y":1072,"wires":[]},{"id":"db6f873c.9c8558","type":"debug","z":"5eb3594f.d294b8","name":"3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":770,"y":1120,"wires":[]},{"id":"26f4b219.ed7a4e","type":"change","z":"5eb3594f.d294b8","name":"","rules":[{"t":"delete","p":"_timerpass","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":596,"y":1024,"wires":[["2a38130d.7c68ec"]]}]
3 Likes

Thanks Kermit, that’s really helpful

Great catch, Kermit. And thanks to both of you!

Out of curiosity, where did you find the source to look through it?