According to the docs:
Subscribes to device commands that are sent to a device. The specified handlerMethod will be called whenever the specified command is sent.
So when a “command” is sent to the device the subscribed method should be called.
However in practice the subscribed method is called even when the the “attribute” state associated with the command changes and the command is not actually called.
For example, if one subscribes to a lock command like:
subscribeToCommand(lock, “lock”, lockHandler)
It should only call the lockHandler when the command “lock” is sent the device right?
However if underlying the lock changes its state to
locked (using sendEvent) WITHOUT the “lock” command actually being called, the lockHandler is still called by the SmartApp.
This can be replicated easily by having the SmartApp call sendEvent and update the state of the attribute of the underlying device without actually calling its command.
@Jim is the expected behavior? I don’t know if you’re still maintaining the docs but would be nice to know if the docs are off or if the platform is not behaving as expected