Debouncer subflow

The reset doesn't fully work as missing wires to reset filters. That flow was to show how complicated it gets to add reset, status etc to the filter method, that's why i went with switches and context storage to add status etc.

The better flow is in post 13, does same with significantly less nodes

This one seems to implement reset better, but shows another strange behaviour.
Sends out the last msg before the reset.

output_reset3

Reset, it reset all so after reset first msg is bypassed, nothing strange there, otherwise it would not be a reset. If you want something different adjust the flow.

Not sure about that.

State was T (1st debug output).
Pressed F, would report F after timeout.
Pressed RESET followed by T --> T is reported (2nd debug output).
2 seconds later F is reported albeit not pressed (3rd debug output).

Ahh I see, there was a count happening when you reset added a reset to trigger, should fix it

[{"id":"dab2306917c00924","type":"subflow","name":"Debouncer with no device id (2)","info":"","category":"","in":[{"x":60,"y":120,"wires":[{"id":"d74ed5c627bb991f"}]}],"out":[{"x":720,"y":180,"wires":[{"id":"e067a4a5e21133c0","port":0}]}],"env":[{"name":"TIME","type":"num","value":"30","ui":{"label":{"en-US":"Time"},"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#E2D96E","status":{"x":720,"y":80,"wires":[{"id":"b47382eebd389ec6","port":0},{"id":"d44694fac9e58657","port":0},{"id":"67d5f9b06515163b","port":0}]}},{"id":"faefee044e7b09eb","type":"change","z":"dab2306917c00924","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"$exists($$.delay) ? $$.delay : $env(\"TIME\") * 1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":260,"wires":[["b2cdce641879c57b"]]},{"id":"b2cdce641879c57b","type":"trigger","z":"dab2306917c00924","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"30","extend":true,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":470,"y":260,"wires":[["038202709c606b95"]]},{"id":"b47382eebd389ec6","type":"change","z":"dab2306917c00924","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{    \"fill\": \"green\",    \"shape\": \"ring\",    \"text\": \"COUNTING\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":80,"wires":[[]]},{"id":"e067a4a5e21133c0","type":"change","z":"dab2306917c00924","name":"","rules":[{"t":"set","p":"device_state","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":200,"wires":[["67d5f9b06515163b"]]},{"id":"67d5f9b06515163b","type":"change","z":"dab2306917c00924","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{    \"fill\": \"green\",    \"shape\": \"dot\",    \"text\": \"WAITING: \" & $$.payload}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":120,"wires":[[]]},{"id":"0eb8944d7aa716dc","type":"inject","z":"dab2306917c00924","name":"","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":210,"y":40,"wires":[["d74ed5c627bb991f"]]},{"id":"d44694fac9e58657","type":"change","z":"dab2306917c00924","name":"","rules":[{"t":"delete","p":"device_state","pt":"flow"},{"t":"set","p":"payload","pt":"msg","to":"{\"fill\":\"blue\",\"shape\":\"dot\",\"text\":\"TO INIT\"}","tot":"json"},{"t":"delete","p":"reset","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":40,"wires":[[]]},{"id":"d74ed5c627bb991f","type":"switch","z":"dab2306917c00924","name":"","property":"reset","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":190,"y":120,"wires":[["d44694fac9e58657","b2cdce641879c57b"],["5523bfb404583406"]]},{"id":"5523bfb404583406","type":"switch","z":"dab2306917c00924","name":"","property":"device_state","propertyType":"flow","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"neq","v":"payload","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":110,"y":260,"wires":[["e067a4a5e21133c0"],["faefee044e7b09eb","b47382eebd389ec6"],["faefee044e7b09eb"]]},{"id":"038202709c606b95","type":"switch","z":"dab2306917c00924","name":"","property":"device_state","propertyType":"flow","rules":[{"t":"eq","v":"payload","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":260,"wires":[["67d5f9b06515163b"],["e067a4a5e21133c0"]]},{"id":"e05b9351775e79ae","type":"inject","z":"65617ffeb779f51c","name":"Reset","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"sdaDAD","payloadType":"str","x":170,"y":3020,"wires":[["27611f40ff2f67ef"]]},{"id":"27611f40ff2f67ef","type":"subflow:dab2306917c00924","z":"65617ffeb779f51c","name":"","env":[{"name":"TIME","value":"5","type":"num"}],"x":430,"y":3040,"wires":[["39f21f3dc5b9e8ad"]]},{"id":"fd557683b6d30995","type":"inject","z":"65617ffeb779f51c","name":"T","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"delay","v":"5000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":170,"y":3100,"wires":[["27611f40ff2f67ef"]]},{"id":"727268ac0372c161","type":"inject","z":"65617ffeb779f51c","name":"F","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"delay","v":"5000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":170,"y":3140,"wires":[["27611f40ff2f67ef"]]},{"id":"228728b0c42b220d","type":"inject","z":"65617ffeb779f51c","name":"STR","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"delay","v":"5000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"STR","payloadType":"str","x":170,"y":3180,"wires":[["27611f40ff2f67ef"]]},{"id":"39f21f3dc5b9e8ad","type":"debug","z":"65617ffeb779f51c","name":"debug 246","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":3060,"wires":[]}]

[edit fixed internal reset]

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