There is a type issue with deviceCommand() callback's type, impacting the usage of smartApp.deviceCommand() in TypeScript.
deviceCommand() defines a callback with a command parameter of type DeviceCommand. This is incorrect, as DeviceCommand has a component attribute, instead of componentId attribute as obtained from the APIs.
Default deviceCommandHandler() is not impacted, as it uses the interface DeviceCommandsEvent, itself using the correct type DeviceCommandsEventCommand.
This is becoming a mouthful. Here are the current classes :
Note that this PR is marked as incomplete, as this DeviceCommandsEventCommand is difficult to import for external projects. I would leave that decision to you in order to export or create an interface.
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
There is a type issue with
deviceCommand()
callback's type, impacting the usage ofsmartApp.deviceCommand()
in TypeScript.deviceCommand()
defines a callback with acommand
parameter of typeDeviceCommand
. This is incorrect, asDeviceCommand
has acomponent
attribute, instead ofcomponentId
attribute as obtained from the APIs.Default
deviceCommandHandler()
is not impacted, as it uses the interfaceDeviceCommandsEvent
, itself using the correct typeDeviceCommandsEventCommand
.This is becoming a mouthful. Here are the current classes :
Incorrect for
deviceCommand()
https://github.com/SmartThingsCommunity/smartthings-core-sdk/blob/bdd6bcc59044daef46725524e7fb3234d4cc0c1a/src/endpoint/rules.ts#L185-L191Correct for
deviceCommand()
https://github.com/SmartThingsCommunity/smartapp-sdk-nodejs/blob/3725c0f5c6ff1f82a8219ba5399019e707526b49/lib/lifecycle-events.d.ts#L192-L197Note that this PR is marked as incomplete, as this
DeviceCommandsEventCommand
is difficult to import for external projects. I would leave that decision to you in order to export or create an interface.Types of changes