Create Driver command with Enum that is pulled from state value

So here is the deal. I now we can set a command input to ENUM and create a list of the possible options, but i need to be able to populate that list with a variable and then populate that variable based on a state value. Is this even possible?

Simply put my integration potentially supports around 200 different devices. Right now many of the functions are similar and the API is fairly predictable. What isn't though is the light effects. Currently i simply populate a state variable and direct the user to look at that and then enter the number next to the scene name they want to activate. I would like to give the a option to use name instead of number. and have that name populated in the command input options. Everything i have tried so far doesn't seem to actually do anything like this. About as close as i have gotten is to simply get it to take a variable, but that doesn't seem to change the options in the enum input.

I am pretty sure I tried something like this before and it is not possible :frowning:

Preferences can be dynamic, but not commands.

Thanks i was worried about that.

@support_team

Is there any chance this could be added. The alternative is to create a different driver for almost every device in that list which would be well a mess.

Reading your request again.... how many people are going to changing the effect by selecting it, manually from the command? Isnt that something that would more often be done with rules, or possibly be using the next effect command to cycle through them?

I've been finding ChatGPT to be a great assistant to help create some HE drivers by having it generate some sample code that I can then copy/paste and modify to get to what I want the driver to do.

Go to https://chat.openai.com/ and ask it:

"Please create a groovy driver for hubitat that can set a command input to ENUM and create a list of the possible options, but i need to be able to populate that list with a variable and then populate that variable based on a state value"

Well I would hope this would benefit those other methods as well. See if it is enumerated hopefully i can also have that available to RM or maybe through other apps. That would be allot easier then trying the hunt down the # code for each device for every rule.

I would also point out that though I started this talking about Light effect scenes. This could be used for several other aspect of the integration as well.

You technically could call it with the name from RM as long as the function can handle it. RM does not care what is defined for the visible command on the device page, it just calls the function directly with whatever parameter settings you supply in RM.

But yes I agree it could be useful for other things as well, like the ZEN32 for example, the community driver has a command to set the LED colors and depending on the firmware version there are new color options for the LED colors. The driver just has to show all the options to everyone.