Ahhh yes, I see what you’re saying now… a know issue.
When you reference a device directly… any custom attributes or commands listed in the device handler are extracted and used to populate the attribute / command dropdown lists. Custom items are marked with that little arrow symbol to the left of the name.
When referencing a device via a variable, that link is broken and the lists are just populated with a default set of standard attributes and commands.
This is actually something I was talking to @ady624 about last week and he is planning to add the enhancement, allong with a ‘swap device’ feature:
“I think I am going to do that. And while at it, why not swap tit-for-tat as well? Ie swap bulb1 and bulb2 in all pistons. Sounds fun and a bit of a challenge from the perspective of timing out. Also, since bins are saved by the UI, not the groovy app, the UI needs to be involved. Ie the UI needs to actually do the swapping and save bins/update pistons.”
Before @ady624 can do that though, we are working through the final checks on an improved UI layout, which must be released first (few weeks away). If further UI updates are made before that, we could run into merge conflicts, so one thing at a time.
For now, do what you’ve been doing, build the piston with the device referenced directly, then switch over to the variable reference, which will then retain the custom command (until you try to change it).