Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/short-guests-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smartthings/cli": patch
---

include virtual device info in device output
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@oclif/plugin-not-found": "^2.3.1",
"@oclif/plugin-plugins": "^2.1.0",
"@smartthings/cli-lib": "^1.0.0-beta.12",
"@smartthings/core-sdk": "^5.1.0",
"@smartthings/core-sdk": "^5.1.1",
"@smartthings/plugin-cli-edge": "^1.14.1",
"aws-sdk": "^2.1175.0",
"inquirer": "^8.2.4",
Expand Down
15 changes: 15 additions & 0 deletions packages/cli/src/__tests__/lib/commands/devices-util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,21 @@ describe('devices-util', () => {
['uniqueIdentifier', 'manufacturerName', 'modelName', 'swVersion', 'hwVersion'])
})

it('includes virtual device info', () => {
const virtual = { name: 'Virtual Device' }
const device = { virtual } as unknown as Device
tableToStringMock.mockReturnValueOnce('main table')
buildTableFromItemMock.mockReturnValue('virtual device info')

expect(buildTableOutput(tableGeneratorMock, device))
.toEqual('Main Info\nmain table\n\nDevice Integration Info (from virtual)\nvirtual device info\n\n' + summarizedText)

expect(tablePushMock).toHaveBeenCalledTimes(9)
expect(buildTableFromItemMock).toHaveBeenCalledTimes(1)
expect(buildTableFromItemMock).toHaveBeenCalledWith(virtual,
['name', { prop: 'hubId', skipEmpty: true }, { prop: 'driverId', skipEmpty: true }])
})

it.todo('adds multiple components')
it.todo('joins multiple component capabilities with newlines')
it.todo('joins multiple children with newlines')
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/lib/commands/devices-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export const buildTableOutput = (tableGenerator: TableGenerator, device: Device
infoFrom = 'viper'
deviceIntegrationInfo = tableGenerator.buildTableFromItem(device.viper,
['uniqueIdentifier', 'manufacturerName', 'modelName', 'swVersion', 'hwVersion'])
} else if ('virtual' in device) {
infoFrom = 'virtual'
deviceIntegrationInfo = tableGenerator.buildTableFromItem(device.virtual,
['name', { prop: 'hubId', skipEmpty: true }, { prop: 'driverId', skipEmpty: true }])
}

return `Main Info\n${mainInfo}\n\n` +
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@log4js-node/log4js-api": "^1.0.2",
"@oclif/core": "1.9.6",
"@smartthings/core-sdk": "^5.1.0",
"@smartthings/core-sdk": "^5.1.1",
"@types/eventsource": "^1.1.9",
"axios": "^0.21.4",
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/testlib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@smartthings/cli-lib": "^1.0.0-beta.12",
"@smartthings/core-sdk": "^5.1.0"
"@smartthings/core-sdk": "^5.1.1"
},
"devDependencies": {
"@types/jest": "^28.1.5",
Expand Down