if you want to dimm up and down with button pressed and released than you might give the attached node a try.....
You should fine tune the intervall and step size to your requirements
[{"id":"48c5808aaf8c39bc","type":"function","z":"f5502e1a8b0461f9","name":"LED Dimmer","func":"let delta = 13;\nlet brightness\n\nif(msg.payload === \"on\"){\n brightness = context.get('brightness');\n context.set('myInterval', setInterval(myDimmer, 500));\n node.warn(\"on\");\n return null;\n}\nelse if (msg.payload === \"off\"){\n clearInterval(context.get('myInterval'));\n context.set('brightness',brightness);\n return null; \n}\nelse if (msg.payload === \"reset\") {\n clearInterval(context.get('myInterval'));\n brightness = 0;\n context.set('brightness', brightness);\n node.send({ payload: { \"brightness\": brightness }});\n return null;\n}\n\n//--------------------------------------------------------------------\n\nfunction myDimmer() {\n node.warn(brightness);\n node.send({ payload: { \"brightness\": brightness}});\n brightness += delta;\n if (brightness === 364) {\n delta = -13;\n }\n if (brightness === 0) {\n delta = 13;\n }\n}\n\n//--------------------------------------------------------------------","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n \ncontext.set('brightness',0);\n","finalize":"","libs":[],"x":370,"y":640,"wires":[["a7df9deb1460b059"]]},{"id":"f7dd55a08c6ae087","type":"inject","z":"f5502e1a8b0461f9","name":"press","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":170,"y":600,"wires":[["48c5808aaf8c39bc"]]},{"id":"49b6c29373b19858","type":"inject","z":"f5502e1a8b0461f9","name":"release","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":170,"y":640,"wires":[["48c5808aaf8c39bc"]]},{"id":"b484c0d9eb75194c","type":"inject","z":"f5502e1a8b0461f9","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"reset","payloadType":"str","x":170,"y":680,"wires":[["48c5808aaf8c39bc"]]},{"id":"a7df9deb1460b059","type":"debug","z":"f5502e1a8b0461f9","name":"debug 66","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":580,"y":640,"wires":[]}]