Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { LGTV, Inputs, Keys } from 'lgtv-ip-control';
- import * as readline from 'node:readline/promises';
- import { stdin as input, stdout as output } from 'node:process';
- const rl = readline.createInterface({ input, output });
- const tv = new LGTV('10.0.255.183', '1a:2b:3c:4d:5e:6f','MDLLCIDN');
- function sender(){
- try{
- tv.connect()
- .then(async () => {
- async function comm () {
- const kk = await rl.question('enter command: ');
- if (kk.includes('hdmi') | kk.includes('dtv')){
- await tv.setInput(Inputs[kk]);
- console.log(Inputs[kk]);
- }
- else{
- await tv.sendKey(Keys[kk]);
- console.log(Keys[kk]);
- }
- }
- await comm();
- })
- }
- catch(e){
- print(e.name);
- tv.disconnect();
- }
- }
- sender();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement