Does anyone know how can I create a custom command that has a preset list of options to select from?
Something like the "setThermostatMode" in the Nest Thermostat driver:
I have a driver for the sony bravia TV that I ported from ST
I have disabled a lot of the commands because I actually only use on/off but the commands are only commented out (you could re-enable then should you wish)
If nothing else then it can be a starting point.
Let me know if you'd like a copy and I'll put it somewhere for you to download.
Would love that. I am actually trying to retrieve the available commands from the TV. The Sony device has an interface that allows querying which commands that particular TV supports. Once retrieved, I want to make the commands available to the user. That is why I am looking for drop down list for the command button. That would make it so much cleaner, IMO.
It has some extra code for an update I was working on but didn't implement on this driver because I didn't release it
I've just marked it so you can ignore that stuff
Thanks! Going to take a look at that. I guess you don't know either how the hubitat team managed to get the drop down list on the Nest Thermostat commands, right?
Cobra's preferences schema will work, but the display will refresh on each entry selection. Not bad.
I believe the pulldown is define within the metadata commands. For fun, try the below code in a test driver then enter text in each of the three entry parameters. Execute and see results.
command "Test", ["On", "Off", "Really?"]
def Test(a,b,c) {
log.info a
log.info b
log.info c
}
def Test(a,b,c) {
log.info a
log.info b
log.info c
}
Raises some questions:
How do I insert a pull-down in this line? (original question).
Is it possible to range check an input within this line rather than code?
Can I change the 2nd line of the displayed tile (currently a repeat of the top line or visa versa) within the command to indicate something useful?