LG TVs of the 2012 era (before WebOS) allowed control via the network, this command line program allows you to issue commands to a compatible TV on your network.
If this project doesn't meet your needs check the Resources/References section for several others.
This project uses cargo
for build managment and is written entirely in rust
. Binaries are not yet available.
Either clone this repo and run cargo install --path .
or install via https://crates.io with cargo install LGremote
.
TVs can be identified through SSDP which is not yet supported. This is required to find the IP addresses of a TV.
1. LGRemote IPaddress
will cause the TV to display the pairing key.
2. LGRemote IPaddress Key Command
will issue the command to the TV.
3. You can alias the command e.g. alias TV_control="LGRemote 192.168.1.100 123456"
and use it like so TV_control VOLUME_UP
.
| Command | Key | Notes | | --------|-----|------ | | POWER | 1 | Can power the TV off but not on. Consider trying Wake on lan (not all TVs support this). | | NUM0 | 2 | | | NUM1 | 3 | | | NUM2 | 4 | | | NUM3 | 5 | | | NUM4 | 6 | | | NUM5 | 7 | | | NUM6 | 8 | | | NUM7 | 9 | | | NUM8 | 10 | | | NUM9 | 11 | | | UP | 12 | | | DOWN | 13 | | | LEFT | 14 | | | RIGHT | 15 | | | OK | 20 | | | HOME | 21 | | | MENU | 22 | | | BACK | 23 | | | VOLUMEUP | 24 | | | VOLUMEDOWN | 25 | | | MUTE | 26 | | | CHANNELUP | 27 | | | CHANNELDOWN | 28 | | | BLUE | 29 | | | GREEN | 30 | | | RED | 31 | | | YELLOW | 32 | | | PLAY | 33 | | | PAUSE | 34 | | | STOP | 35 | | | FF | 36 | | | REW | 37 | | | SKIPFF | 38 | | | SKIPREW | 39 | | | REC | 40 | | | RECLIST | 41 | | | LIVE | 43 | | | EPG | 44 | | | INFO | 45 | | | ASPECT | 46 | | | EXT | 47 | | | PIP | 48 | | | SUBTITLE | 49 | | | PROGRAMLIST | 50 | | | TEXT | 51 | | | MARK | 52 | | | 3D | 400 | | | 3DLR | 401 | | | DASH | 402 | | | PREV | 403 | | | FAV | 404 | | | QUICKMENU | 405 | | | TEXTOPTION | 406 | | | AUDIODESC | 407 | | | NETCAST | 408 | | | ENERGYSAVE | 409 | | | AV | 410 | | | SIMPLINK | 411 | | | EXIT | 412 | | | RESERVED | 413 | Does nothing? | | PIPCHANNELUP | 414 | | | PIPCHANNELDOWN | 415 | | | PIPSWITCH | 416 | | | APPS | 417 | |
Unfortunately official documentation doesn't seem to be available any longer but several libraries and scripts are available. node-lgtv-api[4] is by far the most complete and useful project. 1. https://github.com/ubaransel/lgcommander 2. https://github.com/grieve/python-lgtv - this is where the command codes are from largely. 3. http://dorchain.net/~joerg/code/lg.py 4. https://github.com/timmson/node-lgtv-api - most useful 5. https://developer.lgappstv.com/TV_HELP/index.jsp?topic=%2Flge.tvsdk.references.book%2Fhtml%2FUDAP%2FUDAP%2FAnnex - defunct
MIT licensed as that is in keeping with previous projects.