Quick rfxtrx question

Looking to finally remove my Vera and move the rfxcom to the pi.

I can see from the docs for rfxcom switch you can use a template to generate a code if you don’t have a remote.

Will the same template work for a light? I have an lw400 so ideally I’d like to generate a code, create the light in hass then put the dimmer switch into learning mode. Am I going about it the right way?