[ST Edge] Are capability command handlers always supposed to 'emit' something?

I’ve been creating LAN device drivers mainly to experiment with UI features. It’s been my experience that unless I have a handler defined and ‘emit’ something, there’s a long pause and then a timeout message in the app. What is ST waiting for? If there’s no handler defined, then how is anything going to happen? Why not pop up an error immediately? What if my handler doesn’t need to emit anything? Am I supposed to return something from the function?

I’ve never been exactly clear about what is going on in that situation. I think perhaps the app is expecting to see the attribute change to whatever it is supposed to be changing to. However it can’t be expecting the capability handler to do that as for many device types it isn’t it’s job. Certainly for Zigbee and Z-Wave device the capability handlers send commands, it is the attribute handlers that emit the events when the devices report their status.

In the capabilities you can specify specific commands that are meant to result in certain attribute values on and off being the classic pair), and you can also define a ‘setter’ command. So I think the app is entitled to barf if the expected attribute value doesn’t appear, though it could do it more gracefully. Whether that is what it is doing, and what it is doing for other commands isn’t clear.

Unfortunately the app lives in an undocumented world of its own. So I’d like to know what it expects too.

While ST may be waiting for ‘something’, it can’t possibly anticipate the outcome of a particular action.

Capabilities can have multiple attributes and multiple commands (functions). The attributes and commands are parallel sections. One is not under the other. The commands can have multiple (even optional) parameters of their own. Any command can be associated with a button on the dashboard. The dashboard button isn’t even part of the capability-- it’s layered in the presentation. Anyway, you can see it gets much more complicated than an on/off switch. :slight_smile:

It can if the capability defines it that way. If an attribute is defined with a setter command then that command must result in the attribute being set to a valid value, and if it has enumCommands then those commands must result in the attribute being set to the defined value. If they don’t then something isn’t working properly.

1 Like