This could also be done by allowing an attribute to be associated and displayed with any command. I did this in SmartThings and the tile displayed the station name (i.e., 60's Folk Radio (from Pandora).
Just started playing with custom commands, and I too would like the ability to have a custom name for the command. Real world scenario: 3 exact same devices, need to expose the same command. They all show up with the same name & no easy way to differentiate between them based on the name displayed in RM.
I don't know if I can explain it well.. but you're using ONE driver to expose the commands (methods) it has implemented (or at least says it's implemented.) Once that's exposed you can ask Hubitat to use that. If you tell Hubitat to use it for a device driver that doesn't have the command, it won't do anything, at least nothing you're expecting.
Said another way... You're using one driver to define how the command is spelled. (In your case, P.. I.. N... G, no parameters.) You can then ask any driver to use the command, spelled that way. If the driver has the command, spelled that way, it will do it. If not, an error gets logged.
I've created several Custom Commands. One is from a Dual Relay driver. Has an On and Off command, one for each "side" of the physical device. The specific commands are "on1()", "on2()", "off1()", "off2()".
Yet I can tell RM to use the command on any switch type device. In this case a virtual switch that tests sending words out a speaker. In other words a completely fake use.
When I cause the rule to run, I get this error in the log:
You are talking about a case when there is only one device of specific type. What if there are two or more. For example, one have 2 Aeotec power strips and two identical custom commands are created to turn on outlet. If custom name can't be changed then both be named on1(). How it can be defined which command corresponds to specific strip in RM? Only guessing I think. So we obviously need to be able to change Custom Command label for clarity.
As @csteele points out, you only need a single ping command. Custom commands, once defined, just become part of RM's 'vocabulary' of actions. Define it with one device, use it with any device that has that command.
To @JDogg016 original point - it would be nice to have a configurable name for a custom command. My use case is like his/hers - Play a sonos playlist. Right now it shows up as: playTrack('x-sonosapi-radio:ST%3a36601058461575458?sid=236&flags=8300&sn=6')
I'd like it to show up as: sonos play top hits playslist
I second this request. Some custom commands in their current notation are absolutely unreadable and it can easily be forgotten what this particular command is for.
Here's an example. There are two custom commands with setEffect in their title. The setEffect(4) is for my Front Porch Aeotec LED Bulb. It has a flashing red/blue effect called "Police" which I set so that if my alarm has gone off, there is a visual outside. The setEffect(9) is for my NanoLeaf and I call that particular effect for my evening lights.
So now I have to be careful if I want to use the number 4 effect of my NanoLeaf as I will get confused with the Aeotec bulb.