0.1.0 • Published 4 years ago

tcl-remote v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

TCL Remote

The idea of this proyect is to provide a node interface for interacting with the TCL remote control protocol.

This project was bootstrapped with TSDX.

Examples

import { Finder, Device, Remote } from 'tcl-remote';
import { Keys } from 'tcl-remote/Remote';

async function main(): void {
  const finder = new Finder();

  // Find the first possible location of a TCL tv
  const location = await finder.find();
  await finder.close();

  console.log('location', location);

  // Create a Device Object to get information about the device
  const device = new Device(location);
  const props = await device.fetch();

  console.log(props);

  // Should probably use a better regex to match the ip
  const match = location.match(/(\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?)/);

  if (match) {
    // Create a remote instance
    const device = new Remote(match[1]);

    //Press the mute key
    await device.press(Keys.Mute);

    device.close();
  }
}

main();

See Examples

Related projects