Values in Enums for Device Drivers?

Hi all,

I am coding up a simple device driver to control a custom device on my system.

I would like to use a descriptive drop down to select an option, but then I want to pass an integer.


command "Flash", [
            [name:"Color", type: "ENUM", description:"Send a command string", constraints: ["Red", "Green", "Blue"]],
            [name:"Milliseconds", type: "NUMBER", description:"Milliseconds"]

So I would like to be able to access Color.value and have that be an integer...

def Flash(Number Color, Number Milliseconds){}

I am not sure how to accomplish this in this context.

I tried to define an enum as per the data types in the documentation, but the IDE rejected this outright.

EDIT: OK, I defined a map and used that to look up the integer. Is this the best way to go about it?