How to make custom `command` parameters Required?

Built-in capabilities apparently use some mechanism to define that certain parameters are required, as in deviceNotification for the Notification capability:

(Note the red underline for the Text* parameter).

I know how to specify the title for the parameter:

    command  "fooCommand", ["Text"]

I'd really like to implement "required" for parameters of custom commands in my drivers - can someone tell me (us) how this can be accomplished?

So you mean you'd like some kind of error to be presented if the user doesn't enter / select the parameter(s)?

Currently the only source of documentation on the command definition / syntax I'm aware of is here:

No required parameter functionality is described, so it seems that would have to be handled by the command's method in the driver's code somehow.

Well, that's a help...

Yes - I'm try to ensure the user enters the proper commands in the Hubitat Web Console for the device, should they be testing/trying stuff there.

I wonder what happens if I add a required: true attribute to the command map...I'll try that when I get the chance...

Actually - the answer is in fact in that paragraph you referenced (emphasis mine):

Name is the value that shows up where "ENUM" used to be, directly above the input. If the name ends with an asterisk (*) it will be considered required and the input box will be red and the button will not submit without a value

1 Like

Clearly I should have read that post a second time! For some reason I thought the asterisk feature was only related to ENUM, but your OP screenshot clearly shows its use with a string. Glad to be of (indirect) help! :slightly_smiling_face:

1 Like