diff --git a/src/scripts/alwaysOnTest.ts b/src/scripts/alwaysOnTest.ts index 3217bf4..ed76f77 100644 --- a/src/scripts/alwaysOnTest.ts +++ b/src/scripts/alwaysOnTest.ts @@ -41,13 +41,16 @@ const hostname = values['hostname'] as string; let pictureSettingsOff: null|PictureSetting = null; +const logger = { + error: rl.write, +}; (async () => { rl.write('Running first test to determine if TV is always on or off'); await rl.question('Turn your TV off now and press enter when ready: '); rl.write('Wait for a few seconds...'); try { - const mqttHelper = new HisenseMQTTClient({sslmode: sslMode, ipaddress: hostname, sslcertificate: sslCertificate, sslprivatekey: sslPrivateKey}, macaddress, console); + const mqttHelper = new HisenseMQTTClient({sslmode: sslMode, ipaddress: hostname, sslcertificate: sslCertificate, sslprivatekey: sslPrivateKey}, macaddress, logger); const timeout = setTimeout(() => { mqttHelper.mqttClient.end(true); rl.write('Could not detect always on TV'); diff --git a/src/scripts/authorize.ts b/src/scripts/authorize.ts index 2dd4547..ad8adeb 100644 --- a/src/scripts/authorize.ts +++ b/src/scripts/authorize.ts @@ -39,8 +39,12 @@ const sslPrivateKey = (values['keyfile'] ?? '') as string; const macaddress = values['mac'] as string; const hostname = values['hostname'] as string; +const logger = { + error: rl.write, +}; + try { - const mqttHelper = new HisenseMQTTClient({sslmode: sslMode, ipaddress: hostname, sslcertificate: sslCertificate, sslprivatekey: sslPrivateKey}, macaddress, console); + const mqttHelper = new HisenseMQTTClient({sslmode: sslMode, ipaddress: hostname, sslcertificate: sslCertificate, sslprivatekey: sslPrivateKey}, macaddress, logger); mqttHelper.mqttClient.on('connect', () => { mqttHelper.callService('ui_service', 'gettvstate'); diff --git a/src/scripts/sendCommand.ts b/src/scripts/sendCommand.ts index 96809df..7697df8 100644 --- a/src/scripts/sendCommand.ts +++ b/src/scripts/sendCommand.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import {parseArgs} from 'node:util'; -import {HisenseMQTTClient} from '../hisenseMQTTClient'; +import {HisenseMQTTClient} from '../hisenseMQTTClient.js'; import readline from 'node:readline/promises'; const args = process.argv.slice(2); @@ -52,8 +52,12 @@ if(!(action in getCommands)) { process.exit(1); } +const logger = { + error: rl.write, +}; + try{ - const mqttHelper = new HisenseMQTTClient({sslmode: sslMode, ipaddress: hostname, sslcertificate: sslCertificate, sslprivatekey: sslPrivateKey}, macaddress); + const mqttHelper = new HisenseMQTTClient({sslmode: sslMode, ipaddress: hostname, sslcertificate: sslCertificate, sslprivatekey: sslPrivateKey}, macaddress, logger); mqttHelper.mqttClient.on('connect', () => {