All Projects → WesSouza → lgtv-ip-control

WesSouza / lgtv-ip-control

Licence: MIT license
IP Control module for 2018+ LG TVs

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to lgtv-ip-control

Amazon-Alexa-As-LG-TV-Remote
Control your LG WebOS 3.0+ TV with Amazon Alexa
Stars: ✭ 22 (-37.14%)
Mutual labels:  remote-control, tv, lg
Duckietv
A web application built with AngularJS to track your favorite tv-shows with semi-automagic torrent integration
Stars: ✭ 942 (+2591.43%)
Mutual labels:  remote-control, tv
lgtv2mqtt
Interface between LG WebOS Smart TVs and MQTT 📺
Stars: ✭ 90 (+157.14%)
Mutual labels:  tv, lg
RootMyTV.github.io
RootMyTV is a user-friendly exploit for rooting/jailbreaking LG webOS smart TVs.
Stars: ✭ 745 (+2028.57%)
Mutual labels:  tv
ZiggoNext
Custom component to integrate Arris DCX960 Horizon EOS Settopbox into Home Assistant
Stars: ✭ 33 (-5.71%)
Mutual labels:  tv
mbrc
MusicBee Remote for Android
Stars: ✭ 96 (+174.29%)
Mutual labels:  remote-control
rocc
A Swift framework for remote control of digital Cameras
Stars: ✭ 68 (+94.29%)
Mutual labels:  remote-control
iTunesSearch
🎵 A .NET wrapper to the iTunes search API
Stars: ✭ 20 (-42.86%)
Mutual labels:  tv
streaming-pt
Live TV 📺 and Radio 📻 shell scripts from Portugal 🇵🇹.
Stars: ✭ 52 (+48.57%)
Mutual labels:  tv
DuinoDCX
WiFi remote controller for the Behringer Ultradrive.
Stars: ✭ 67 (+91.43%)
Mutual labels:  remote-control
ControllerBuddy
Highly advanced game controller mapping
Stars: ✭ 47 (+34.29%)
Mutual labels:  remote-control
Nfsc21
Nota Fiscal de Serviço de Comunicação e Telecomunicação, modelo 21 e 22
Stars: ✭ 20 (-42.86%)
Mutual labels:  tv
onkyo.js
Onkyo Receiver controller module
Stars: ✭ 21 (-40%)
Mutual labels:  remote-control
adb-cheatsheet
Your journey to master Android™ Shell begins here
Stars: ✭ 44 (+25.71%)
Mutual labels:  lg
pace
Remote Access Tool for Windows.
Stars: ✭ 68 (+94.29%)
Mutual labels:  remote-control
libdvbtee
dvbtee: a digital television streamer / parser / service information aggregator supporting various interfaces including telnet CLI & http control
Stars: ✭ 65 (+85.71%)
Mutual labels:  tv
homeberry
HomeBerry is an Android remote control app for your Raspberry PI
Stars: ✭ 31 (-11.43%)
Mutual labels:  remote-control
termv
A terminal iptv player written in bash
Stars: ✭ 119 (+240%)
Mutual labels:  tv
SALT
SALT - [S]teadfasterX [A]ll-in-one [L]G [T]ool ( https://bit.do/SALTatXDA )
Stars: ✭ 51 (+45.71%)
Mutual labels:  lg
Micro RC Receiver
An Atmega328P based 2.4GHz receiver with integrated TB6612FNG motor driver. PWM and SBUS outputs.
Stars: ✭ 115 (+228.57%)
Mutual labels:  remote-control

LG TV IP Control

Install, lint, test and build status badge

npm version badge

This is a JS library that implements TCP network control for LG TVs manufactured since 2018. It utilizes encryption rules based on a guide found on the internet.

This is not provided by LG, and it is not a complete implementation for every TV model.

Requirements

  • LG TV (tested on model OLED65B9PUA)
  • Node 12+ (at least ES2017)

Installing

# Using NPM
npm install lgtv-ip-control

# Using Yarn
yarn add lgtv-ip-control

Setting Up the TV

Before anything, you need to enable Network IP Control, which is very easy:

  1. Open the "All Settings" menu on the TV
  2. Using the remote arrows, navigate to "Connection". For some TVs, this may say "Network" instead.
  3. Quickly, press 82888 using the remote numeric buttons
  4. Note the MAC IP addresses for reference and library configuration
  5. Turn "Network IP Control" on
  6. Click "Generate Keycode", and take note of the 8 characters code displayed on the message for reference and library configuration. You can generate a new code at any time
  7. If you want to be able to turn the TV on, turn "Wake On LAN" on

Library Usage

Here's a very basic example of how to control the TV:

const tv = new LGTV('192.168.1.100', '1a:2b:3c:4d:5e:6f', 'KEY1C0DE');

tv.connect()
  .then(async () => {
    console.log('Unmutting...');
    await tv.setVolumeMute(false);
    console.log('Setting volume to 15...');
    await tv.setVolume(50);
    console.log('Done!');
  })
  .catch(console.error);

new LGTV()

Returns a new instance to control a TV.

const lgtv = new LGTV(
  /**
   * TV IP Address
   */
  '192.168.1.100',

  /**
   * TV MAC Address for being able to turn the TV on remotely, `null` otherwise
   */
  '1a:2b:3c:4d:5e:6f',

  /**
   * Encryption Keycode, as generated during "Setting Up the TV" above
   */
  'KEY1C0DE',

  /**
   * Additional options (optional)
   *
   * See src/constants/DefaultSettings.ts file.
   */
  {
    ...DefaultSettings,
  }
);

.connect()

Connects to the TV using HTTP. Returns a promise.

Required before sending any commands.

await lgtv.connect();

.disconnect()

Disconnects from the TV. Returns a promise.

await lgtv.disconnect();

.getCurrentApp()

Gets the current app. Returns a promise.

const currentApp = await lgtv.getCurrentApp();

.getCurrentVolume()

Gets the current volume. Returns a promise.

const currentVolume = await lgtv.getCurrentVolume();

.getIpControlState()

Gets the ip control state. Returns a promise.

const ipControlState = await lgtv.getIpControlState();

.getMacAddress(type: 'wired' | 'wifi')

Gets the mac address by type. Returns a promise.

const macAddress = await lgtv.getMacAddress('wired');

.getMuteState()

Gets the mute state. Returns a promise.

const muteState = await lgtv.getMuteState();

.powerOff()

Powers the TV off. Returns a promise.

await lgtv.powerOff();

.powerOn()

Powers the TV on, using Wake On Lan. Requires MAC address to be set when creating the LGTV instance.

Returns nothing.

lgtv.powerOn();

.sendKey(key: Keys)

Sends a key, as if it was pressed on the TV remote control. Returns a promise.

await lgtv.sendKey(Keys.menu);

See Keys for available keys.

.setEnergySaving(level: EnergySavingLevels)

Sets the current energy saving level. Returns a promise.

await lgtv.setEnergySaving(EnergySavingLevels.maximum);

See EnergySavingLevels for available levels.

.setInput(input: Inputs)

Sets the current TV input. Returns a promise.

await lgtv.setInput(Inputs.hdmi1);

See Inputs for available inputs.

.setVolume(volume: number)

Sets the volume level, from 0 to 100. Returns a promise.

await lgtv.setVolume(15);

.setVolumeMute(isMuted: boolean)

Sets the volume mute state. Returns a promise.

await lgtv.setVolumeMute(false);

Available Lists

EnergySavingLevels

Key Brightness Level
auto Automatic
screenOff Screen Off
maximum Low
medium Medium
minimum High
off Maximum

Inputs

Key Input
dtv Digital TV
atv Analog TV
cadtv Cable Digital TV
catv Cable TV
av AV Composite
component Component
hdmi1 HDMI 1
hdmi2 HDMI 2
hdmi3 HDMI 3
hdmi4 HDMI 4

Keys

Key Remote Button
arrowDown Arrow Down
arrowLeft Arrow Left
arrowRight Arrow Right
arrowUp Arrow Up
aspectRatio Aspect Ratio Toggle
audioMode Audio Mode Toggle
back Back
blueButton Blue Button
captionSubtitle
channelDown Channel Down
channelList Channel List
channelUp Channel Up
deviceInput Device Input Toggle
energySaving Energy Saving Toggle
fastForward
greenButton Green Button
home Home
info Info
liveTV Live TV
menu Open Menu
number0 Number 0
number1 Number 1
number2 Number 2
number3 Number 3
number4 Number 4
number5 Number 5
number6 Number 6
number7 Number 7
number8 Number 8
number9 Number 9
ok Ok
play
previousChannel Previous Channel
programGuide Show Program Guide
record
redButton Red Button
rewind
sleepTimer Sleep Timer Toggle
userGuide Open User Guide
videoMode Video Mode Toggle
volumeDown Volume Down
volumeMute Mute Toggle
volumeUp Volume Up
yellowButton Yellow Button

License

MIT, https://wes.dev/LICENSE.txt

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].