From 634acb123ec9f215a398fd127e6542d5f44e92cd Mon Sep 17 00:00:00 2001 From: ianshade Date: Thu, 5 Oct 2023 21:39:56 +0200 Subject: [PATCH 1/2] fix(quick-tsr): status logging used to be [object Object] --- packages/quick-tsr/src/tsrHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/quick-tsr/src/tsrHandler.ts b/packages/quick-tsr/src/tsrHandler.ts index 2233bb958e..52ef44211d 100644 --- a/packages/quick-tsr/src/tsrHandler.ts +++ b/packages/quick-tsr/src/tsrHandler.ts @@ -145,7 +145,7 @@ export class TSRHandler { this._devices[deviceId] = device await device.device.on('connectionChanged', ((status: DeviceStatus) => { - console.log(`Device ${device.deviceId} status changed: ${status}`) + console.log(`Device ${device.deviceId} status changed: ${JSON.stringify(status)}`) }) as () => void) await device.device.on('slowCommand', ((_info: SlowSentCommandInfo) => { // console.log(`Device ${device.deviceId} slow command: ${_info}`) From f693569601136d27c5fadb29b95787ef18c607ab Mon Sep 17 00:00:00 2001 From: ianshade Date: Thu, 5 Oct 2023 21:43:02 +0200 Subject: [PATCH 2/2] feat(quick-tsr): add command report and debug logging it can be enabled with `reportAllCommands: true` and `debug: true` respectively --- packages/quick-tsr/src/tsrHandler.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/quick-tsr/src/tsrHandler.ts b/packages/quick-tsr/src/tsrHandler.ts index 52ef44211d..4a64a7902c 100644 --- a/packages/quick-tsr/src/tsrHandler.ts +++ b/packages/quick-tsr/src/tsrHandler.ts @@ -150,6 +150,13 @@ export class TSRHandler { await device.device.on('slowCommand', ((_info: SlowSentCommandInfo) => { // console.log(`Device ${device.deviceId} slow command: ${_info}`) }) as () => void) + await device.device.on('commandReport', ((command: any) => { + console.log(`Device ${device.deviceId} command: ${JSON.stringify(command)}`) + }) as () => void) + await device.device.on('debug', (...args: any[]) => { + const data = args.map((arg) => (typeof arg === 'object' ? JSON.stringify(arg) : arg)) + console.log(`Device ${device.deviceId} debug: ${data}`) + }) // also ask for the status now, and update: // onConnectionChanged(await device.device.getStatus()) } catch (e) {