@william2 - To turn things up to "11" you could add an "environment variable" to your subflow called "ButtonMap" (or whatever) and make it a JSON string then in your function node compare it against the input..
In your example when you place the subflow node you would edit the "ButtonMap" entry to look something like this:
[
{"button":1,"deviceId":"31"},
{"button":4,"deviceId":"278"}
]
Just a way of abstracting things and allowing you to reuse the subflow for other stuff if necessary...
Also on a semi-related note - Heres a repost of a subflow I wrote called "Button Taps" that allows you to handle multi-tapping events even on buttons that don't have that capability. Works with Lutron Picos using both fast and regular drivers... You can have single, double, triple, quadruple or N+ taps and set the length of tap detection time. Will trap "doubleTap" and "held" events if the button/driver supports it.
The "Office Button" in the above sequence is a Samsung SmartThings Button.
It does require the timed-counter node though..
node-red-contrib-timed-counter
@erktreks Button Taps - 210828
[{"id":"d0e305e1.7ad558","type":"subflow","name":"Button Taps","info":"","category":"adsavia dev","in":[{"x":50,"y":30,"wires":[{"id":"dceb31cb.fb78f"}]}],"out":[{"x":1180,"y":40,"wires":[{"id":"959b5260.c1c1c","port":0}]},{"x":1180,"y":100,"wires":[{"id":"959b5260.c1c1c","port":1}]},{"x":1180,"y":160,"wires":[{"id":"959b5260.c1c1c","port":2}]},{"x":1180,"y":220,"wires":[{"id":"959b5260.c1c1c","port":3}]}],"env":[{"name":"TIME_LIMIT_MS","type":"num","value":"450"},{"name":"HELD_TAPS","type":"num","value":"0"}],"meta":{"module":"adsavia-button-taps","version":"1.0","license":"GPL-3.0"},"color":"#E2D96E","inputLabels":["Button Press"],"outputLabels":["Single Tap","Double Tap","Triple Tap","Quad+ Tap"],"icon":"node-red-dashboard/ui_button.png","status":{"x":1180,"y":280,"wires":[{"id":"b4ba35d5.020018","port":0}]}},{"id":"959b5260.c1c1c","type":"switch","z":"d0e305e1.7ad558","name":"Single Tap \\n Double Tap \\n Triple Tap \\n Quad+ Tap","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"str"},{"t":"gte","v":"4","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":930,"y":120,"wires":[[],[],[],[]]},{"id":"4e584c74.8f1724","type":"timed-counter","z":"d0e305e1.7ad558","name":"","timelimit":"${TIME_LIMIT_MS}","timeunit":1,"withhold":true,"fixedtimeout":false,"pertopic":false,"x":680,"y":40,"wires":[["959b5260.c1c1c","b4ba35d5.020018"]]},{"id":"b4ba35d5.020018","type":"function","z":"d0e305e1.7ad558","name":"set status payload","func":"\nvar payload = {\n\"fill\": \"green\",\n\"shape\":\"dot\",\n\"text\": (flow.get(\"held\")!==undefined?\"Held/\":\"\") + ( msg.count == 1 ? \"Single\" : (msg.count == 2 ? \"Double\": (msg.count == 3 ? \"Triple\": (msg.count == 4 ? \"Quadruple\": msg.count.toString() )))) + \" Tap\"\n};\n\nflow.set(\"held\",undefined);\n\nmsg.payload = payload;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":280,"wires":[[]]},{"id":"dbeab83f.200be8","type":"function","z":"d0e305e1.7ad558","name":"Gnerate \"Held\" Taps","func":"var iterate = env.get(\"HELD_TAPS\");\nfor (var i = 0; i < iterate; i++){\n node.send(msg);\n}\n\nflow.set(\"held\",true);\n\nreturn;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":160,"wires":[["4e584c74.8f1724"]]},{"id":"dceb31cb.fb78f","type":"switch","z":"d0e305e1.7ad558","name":"","property":"payload.name","propertyType":"msg","rules":[{"t":"eq","v":"pushed","vt":"str"},{"t":"eq","v":"doubleTapped","vt":"str"},{"t":"eq","v":"held","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":190,"y":40,"wires":[["4e584c74.8f1724"],["b6af3007.c57de","3eafdc18.33b6e4"],["dbeab83f.200be8"]]},{"id":"b6af3007.c57de","type":"delay","z":"d0e305e1.7ad558","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":120,"wires":[["4e584c74.8f1724"]]},{"id":"3eafdc18.33b6e4","type":"delay","z":"d0e305e1.7ad558","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":80,"wires":[["4e584c74.8f1724"]]},{"id":"d7fed3e.1c61a3","type":"subflow:d0e305e1.7ad558","z":"841da7a7.4fb908","name":"","env":[{"name":"TIME_LIMIT_MS","value":"800","type":"num"},{"name":"HELD_TAPS","value":"4","type":"num"},{"name":"DETECT_DOUBLETAP","value":"true","type":"bool"}],"x":410,"y":1200,"wires":[["e7780ce3.1c5a9"],["11e1341.245cacc"],["92dcbe4e.55989"],["6a54cf31.df644"]]}]
