Hello,
sorry for taking so long but I had a busy week.
[{"id":"e31a6805.59a838","type":"switch","z":"fbd0452.6a05538","name":"senderId","property":"meta.senderId","propertyType":"msg","rules":[{"t":"eq","v":"fef9093c","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":460,"y":1020,"wires":[["45597fe8.90d"]]},{"id":"76962ba3.f6dad4","type":"switch","z":"fbd0452.6a05538","name":"whichButton","property":"payload.R1.value","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"3","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":870,"y":960,"wires":[["a3ea5442.76bf1"],["1f514644.87a692"],["47908b5.dd86ef4"],["c37fb8f9.2fe508"]]},{"id":"a3ea5442.76bf1","type":"function","z":"fbd0452.6a05538","name":"left down","func":"switch (msg.payload.EB.description) {\n case \"pressed\":\n context.set(\"pressed\",true);\n let rounds = 0;\n const repeat = setInterval(()=>{\n if (context.get(\"pressed\") === false || rounds === 10) { clearInterval(repeat); }\n node.send({payload:\"pressed\",topic:\"down\"})\n rounds += 1;\n },500)\n break;\n case \"released\":\n const pressed = context.get(\"pressed\") || false;\n if (!pressed) {\n break;\n } else {\n context.set(\"pressed\", false);\n break;\n }\n}\nreturn null;","outputs":1,"noerr":0,"x":1080,"y":960,"wires":[["8b78ed6.ec25d1"]]},{"id":"45597fe8.90d","type":"switch","z":"fbd0452.6a05538","name":"pressed/released","property":"payload.EB.description","propertyType":"msg","rules":[{"t":"eq","v":"pressed","vt":"str"},{"t":"eq","v":"released","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":1020,"wires":[["76962ba3.f6dad4"],["a3ea5442.76bf1","1f514644.87a692","47908b5.dd86ef4","c37fb8f9.2fe508"]]},{"id":"1f514644.87a692","type":"function","z":"fbd0452.6a05538","name":"left up","func":"switch (msg.payload.EB.description) {\n case \"pressed\":\n context.set(\"pressed\",true);\n let rounds = 0;\n const repeat = setInterval(()=>{\n if (context.get(\"pressed\") === false || rounds === 10) { clearInterval(repeat); }\n node.send({payload:\"pressed\",topic:\"up\"})\n rounds += 1;\n },500)\n break;\n case \"released\":\n const pressed = context.get(\"pressed\") || false;\n if (!pressed) {\n break;\n } else {\n context.set(\"pressed\", false);\n break;\n }\n}\nreturn null;","outputs":1,"noerr":0,"x":1070,"y":1000,"wires":[["8b78ed6.ec25d1"]]},{"id":"47908b5.dd86ef4","type":"function","z":"fbd0452.6a05538","name":"right down","func":"switch (msg.payload.EB.description) {\n case \"pressed\":\n context.set(\"pressed\",true);\n let rounds = 0;\n const repeat = setInterval(()=>{\n if (context.get(\"pressed\") === false || rounds === 10) { clearInterval(repeat); }\n node.send({payload:\"pressed\",topic:\"down\"})\n rounds += 1;\n },500)\n break;\n case \"released\":\n const pressed = context.get(\"pressed\") || false;\n if (!pressed) {\n break;\n } else {\n context.set(\"pressed\", false);\n break;\n }\n}\nreturn null;","outputs":1,"noerr":0,"x":1090,"y":1040,"wires":[["feefbd4e.0bb268"]]},{"id":"c37fb8f9.2fe508","type":"function","z":"fbd0452.6a05538","name":"right up","func":"switch (msg.payload.EB.description) {\n case \"pressed\":\n context.set(\"pressed\",true);\n let rounds = 0;\n const repeat = setInterval(()=>{\n if (context.get(\"pressed\") === false || rounds === 10) { clearInterval(repeat); }\n node.send({payload:\"pressed\",topic:\"up\"})\n rounds += 1;\n },500)\n break;\n case \"released\":\n const pressed = context.get(\"pressed\") || false;\n if (!pressed) {\n break;\n } else {\n context.set(\"pressed\", false);\n break;\n }\n}\nreturn null;","outputs":1,"noerr":0,"x":1080,"y":1080,"wires":[["feefbd4e.0bb268"]]},{"id":"edc1496a.315e6","type":"debug","z":"fbd0452.6a05538","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1470,"y":1060,"wires":[]},{"id":"feefbd4e.0bb268","type":"function","z":"fbd0452.6a05538","name":"right state","func":"let state = flow.get(\"Rocker1RightState\") || 0;\nswitch (msg.topic) {\n case \"up\":\n if (state < 100) {\n state += 10;\n node.send({payload:state});\n }\n break;\n case \"down\":\n if (state > 0) {\n state -= 10;\n node.send({payload:state});\n }\n break;\n}\nflow.set(\"Rocker1RightState\", state);\nreturn null;","outputs":1,"noerr":0,"x":1300,"y":1060,"wires":[["edc1496a.315e6"]]},{"id":"f201122b.77f9a8","type":"debug","z":"fbd0452.6a05538","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1470,"y":980,"wires":[]},{"id":"8b78ed6.ec25d1","type":"function","z":"fbd0452.6a05538","name":"left state","func":"let state = flow.get(\"Rocker1LeftState\") || 0;\nswitch (msg.topic) {\n case \"up\":\n if (state < 100) {\n state += 10;\n node.send({payload:state});\n }\n break;\n case \"down\":\n if (state > 0) {\n state -= 10;\n node.send({payload:state});\n }\n break;\n}\nflow.set(\"Rocker1LeftState\", state);\nreturn null;","outputs":1,"noerr":0,"x":1300,"y":980,"wires":[["f201122b.77f9a8"]]}]
This should do what you want.
I changed the first function node for each button to repeat a message every 500ms using the javascript setInterval() method as long as its pressed with the method from the previous flow i posted.
I added a second function node for each side of the switch. This gets the state of the lamp which it controls which is saved as a flow variable. if the message is up it increments that variable by 10 and sends the result as long as less than 100. Opposite happens for down.
So you an connect a slider to this to show the result.
For it to properly work use a change node after the slider set to the same flow.var that the function before uses to keep state and loop the slider back into itself.
Set the slider to set its value from the input and not pass through.
Hope this helps.
Johannes