@su-thomas/homebridge-webos-tv
Version:
Homebridge plugin for LG webOS TVs
41 lines (36 loc) • 926 B
JavaScript
import * as log from '../log.js';
import chalk from 'chalk';
import WebosTvHelper from '../../lib/tools/WebosTvHelper.js';
export const command = 'serviceMenu <ip> <mac>';
export const description = 'Open the service menu on the TV';
export const builder = {
timeout: {
required: false,
alias: 't',
type: 'number',
description: 'The call timeout in ms. Default: 5000ms'
},
debug: {
required: false,
alias: 'd',
type: 'boolean',
description: 'Enable debug output'
}
};
export const handler = async argv => {
const {
ip,
mac,
timeout,
debug
} = argv;
try {
log.info(`Trying to open the service menu on the TV (${chalk.yellow(ip)})`);
let lgTvCtrl = await WebosTvHelper.connect(ip, mac, debug, timeout);
await lgTvCtrl.openServiceMenu();
log.success(`Service menu opened!`);
} catch (err) {
log.error(err.message);
}
process.exit(0);
};