Node-RED subflow for IKEA Tradfri dimmer using Zigbee2MQTT

I just learned yesterday that you can bind the remote directly to the lamp with Zigbee2MQTT.
So you should consider that instead, and only go this route if your devices doesn’t support binding.