Set Value of a command input control when another command input control changes

Is it possible to set the value shown for an input in the "command" section when another input changes?

My specific use case is for the Generic Component Fan driver. When I change the fan speed via the "Set Speed" control, I'd also like to update the "Set Level" control to show the corresponding level and vice-versa. I realize you can get the "true" values in the Current States section, but I'd like the controls themselves to also show the true values after one of the controls changes.

I would have expected this to be answered on the "command object" developer page, but that has become a blank: https://docs.hubitat.com/index.php?title=Command_Object&action=edit&redlink=1

Old question, but in case anyone else runs across this: One approach is to put submitOnChange: true on the controls, which will reload the page -- and re-run your logic -- when one of them changes. The challenge then is to determine which is the old value and which the new, but you could tuck the previous value in state or something like that.

If anyone has better suggestions, I'd love a less-hacky pattern to do so. I'm currently exploring Javascript injection, so that only one of the inputs is a "true" input and the others update the true one from the JS handler.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.