lgtvremote-cli 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lgtvremote_cli-1.0.0/LICENSE +21 -0
- lgtvremote_cli-1.0.0/PKG-INFO +288 -0
- lgtvremote_cli-1.0.0/README.md +270 -0
- lgtvremote_cli-1.0.0/lgtvremote_cli.egg-info/PKG-INFO +288 -0
- lgtvremote_cli-1.0.0/lgtvremote_cli.egg-info/SOURCES.txt +9 -0
- lgtvremote_cli-1.0.0/lgtvremote_cli.egg-info/dependency_links.txt +1 -0
- lgtvremote_cli-1.0.0/lgtvremote_cli.egg-info/entry_points.txt +2 -0
- lgtvremote_cli-1.0.0/lgtvremote_cli.egg-info/top_level.txt +1 -0
- lgtvremote_cli-1.0.0/lgtvremote_cli.py +1698 -0
- lgtvremote_cli-1.0.0/pyproject.toml +29 -0
- lgtvremote_cli-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gary Riches
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lgtvremote-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Command-line interface for controlling LG webOS TVs
|
|
5
|
+
Author: Gary Riches
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/griches/lgtvremote-cli
|
|
8
|
+
Keywords: lg,tv,webos,remote,cli
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Home Automation
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# LG TV Remote CLI
|
|
20
|
+
|
|
21
|
+
## Command-line interface for controlling LG webOS TVs over your local network.
|
|
22
|
+
|
|
23
|
+
Communicates via WebSocket using the SSAP (Simple Service Access Protocol) on port 3001. Supports TV discovery, PIN-based pairing, remote control, app launching, input switching, Wake-on-LAN, and more.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Only Python 3.9+ is required (ships with macOS and most Linux distros).
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Clone the repo
|
|
31
|
+
git clone https://github.com/griches/lgtvremote-cli.git
|
|
32
|
+
cd lgtvremote-cli
|
|
33
|
+
|
|
34
|
+
# Option 1: Add a shell alias (recommended)
|
|
35
|
+
echo 'alias lgtv="python3 '$(pwd)'/lgtvremote_cli.py"' >> ~/.zshrc
|
|
36
|
+
source ~/.zshrc
|
|
37
|
+
|
|
38
|
+
# Option 2: Symlink into your PATH
|
|
39
|
+
ln -s $(pwd)/lgtvremote_cli.py /usr/local/bin/lgtv
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If you don't have Python 3 installed:
|
|
43
|
+
|
|
44
|
+
| Platform | Install |
|
|
45
|
+
|----------|---------|
|
|
46
|
+
| macOS | `brew install python3` |
|
|
47
|
+
| Ubuntu/Debian | `sudo apt install python3` |
|
|
48
|
+
| Fedora/RHEL | `sudo dnf install python3` |
|
|
49
|
+
| Windows | `winget install Python.Python.3` or [python.org](https://www.python.org/downloads/) |
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 1. Scan, add, and pair — all in one step
|
|
55
|
+
lgtv scan
|
|
56
|
+
# Finds TVs, adds them, asks to pair, fetches MAC addresses for Wake-on-LAN
|
|
57
|
+
|
|
58
|
+
# 2. Control your TV
|
|
59
|
+
lgtv off # Turn off
|
|
60
|
+
lgtv on # Wake via Wake-on-LAN
|
|
61
|
+
lgtv launch Netflix # Launch apps by name
|
|
62
|
+
lgtv volume set 20 # Set volume
|
|
63
|
+
lgtv input 1 # Switch to HDMI 1
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or if you know the IP:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
lgtv add 192.168.1.100 # Adds, pairs, and fetches MACs automatically
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
Device data is stored in `~/.config/lgtvremote/devices.json`. This includes IP addresses, names, MAC addresses, and pairing keys.
|
|
75
|
+
|
|
76
|
+
## Command Reference
|
|
77
|
+
|
|
78
|
+
### Device Management
|
|
79
|
+
|
|
80
|
+
| Command | Description |
|
|
81
|
+
|---------|-------------|
|
|
82
|
+
| `lgtv scan` | Discover TVs, auto-add, pair, and fetch MAC addresses |
|
|
83
|
+
| `lgtv add <ip>` | Add a TV by IP — auto-enriches, pairs, and fetches MACs |
|
|
84
|
+
| `lgtv add <ip> --name "Living Room"` | Add with a custom name |
|
|
85
|
+
| `lgtv remove <ip>` | Remove a saved TV |
|
|
86
|
+
| `lgtv list` | List all saved TVs |
|
|
87
|
+
| `lgtv set-default <ip>` | Set the default TV for commands |
|
|
88
|
+
| `lgtv pair` | Re-pair with a TV (if needed) |
|
|
89
|
+
| `lgtv enrich` | Re-fetch model name and MAC addresses from TV |
|
|
90
|
+
|
|
91
|
+
### Power
|
|
92
|
+
|
|
93
|
+
| Command | Description |
|
|
94
|
+
|---------|-------------|
|
|
95
|
+
| `lgtv on` | Turn on TV via Wake-on-LAN (requires stored MAC address) |
|
|
96
|
+
| `lgtv off` | Turn off TV |
|
|
97
|
+
| `lgtv power` | Toggle power (off via WebSocket, on via WOL if unreachable) |
|
|
98
|
+
|
|
99
|
+
### Volume
|
|
100
|
+
|
|
101
|
+
| Command | Description |
|
|
102
|
+
|---------|-------------|
|
|
103
|
+
| `lgtv volume up` | Volume up |
|
|
104
|
+
| `lgtv volume down` | Volume down |
|
|
105
|
+
| `lgtv volume set <0-100>` | Set volume to specific level |
|
|
106
|
+
| `lgtv volume get` | Get current volume and mute status |
|
|
107
|
+
| `lgtv volume mute` | Mute |
|
|
108
|
+
| `lgtv volume unmute` | Unmute |
|
|
109
|
+
|
|
110
|
+
### Navigation
|
|
111
|
+
|
|
112
|
+
| Command | Description |
|
|
113
|
+
|---------|-------------|
|
|
114
|
+
| `lgtv nav up` | Navigate up |
|
|
115
|
+
| `lgtv nav down` | Navigate down |
|
|
116
|
+
| `lgtv nav left` | Navigate left |
|
|
117
|
+
| `lgtv nav right` | Navigate right |
|
|
118
|
+
| `lgtv nav ok` | Select / OK / Enter |
|
|
119
|
+
| `lgtv nav back` | Go back |
|
|
120
|
+
| `lgtv nav home` | Go to home screen |
|
|
121
|
+
| `lgtv nav menu` | Open menu |
|
|
122
|
+
|
|
123
|
+
### Channels
|
|
124
|
+
|
|
125
|
+
| Command | Description |
|
|
126
|
+
|---------|-------------|
|
|
127
|
+
| `lgtv channel up` | Next channel |
|
|
128
|
+
| `lgtv channel down` | Previous channel |
|
|
129
|
+
| `lgtv channel set <number>` | Switch to specific channel |
|
|
130
|
+
|
|
131
|
+
### Media Controls
|
|
132
|
+
|
|
133
|
+
| Command | Description |
|
|
134
|
+
|---------|-------------|
|
|
135
|
+
| `lgtv play` | Play |
|
|
136
|
+
| `lgtv pause` | Pause |
|
|
137
|
+
| `lgtv stop` | Stop playback |
|
|
138
|
+
| `lgtv rewind` | Rewind |
|
|
139
|
+
| `lgtv ff` | Fast forward |
|
|
140
|
+
| `lgtv skip-forward` | Skip forward / next track |
|
|
141
|
+
| `lgtv skip-back` | Skip backward / previous track |
|
|
142
|
+
|
|
143
|
+
### Input / HDMI
|
|
144
|
+
|
|
145
|
+
| Command | Description |
|
|
146
|
+
|---------|-------------|
|
|
147
|
+
| `lgtv input 1` | Switch to HDMI 1 |
|
|
148
|
+
| `lgtv input 2` | Switch to HDMI 2 |
|
|
149
|
+
| `lgtv input HDMI_3` | Switch to HDMI 3 (full ID) |
|
|
150
|
+
| `lgtv inputs` | List all available inputs |
|
|
151
|
+
|
|
152
|
+
### Apps
|
|
153
|
+
|
|
154
|
+
Launch any app by its display name — matches against what's installed on your TV:
|
|
155
|
+
|
|
156
|
+
| Command | Description |
|
|
157
|
+
|---------|-------------|
|
|
158
|
+
| `lgtv launch Netflix` | Launch Netflix |
|
|
159
|
+
| `lgtv launch YouTube` | Launch YouTube |
|
|
160
|
+
| `lgtv launch "Disney+"` | Launch Disney+ |
|
|
161
|
+
| `lgtv launch "Prime Video"` | Launch Prime Video |
|
|
162
|
+
| `lgtv launch Plex` | Launch Plex |
|
|
163
|
+
| `lgtv launch browser` | Launch web browser (shortcut) |
|
|
164
|
+
| `lgtv launch settings` | Open TV settings (shortcut) |
|
|
165
|
+
| `lgtv launch <app-id>` | Launch by webOS app ID |
|
|
166
|
+
| `lgtv apps` | List all installed apps with their IDs |
|
|
167
|
+
| `lgtv app` | Show currently running foreground app |
|
|
168
|
+
|
|
169
|
+
#### Supported App Shortcuts
|
|
170
|
+
|
|
171
|
+
| Shortcut | App ID |
|
|
172
|
+
|----------|--------|
|
|
173
|
+
| `netflix` | `netflix` |
|
|
174
|
+
| `youtube` | `youtube.leanback.v4` |
|
|
175
|
+
| `amazon` / `prime` / `primevideo` | `amazon` |
|
|
176
|
+
| `disney` / `disney+` / `disneyplus` | `com.disney.disneyplus-prod` |
|
|
177
|
+
| `hulu` | `hulu` |
|
|
178
|
+
| `hbo` / `hbomax` | `hbo-go-2` |
|
|
179
|
+
| `apple` / `appletv` | `com.apple.tv` |
|
|
180
|
+
| `spotify` | `spotify-beehive` |
|
|
181
|
+
| `plex` | `plex` |
|
|
182
|
+
| `crunchyroll` | `crunchyroll` |
|
|
183
|
+
| `twitch` | `twitch` |
|
|
184
|
+
| `vudu` | `vudu` |
|
|
185
|
+
| `livetv` / `tv` | `com.webos.app.livetv` |
|
|
186
|
+
| `settings` | `com.webos.app.settings` |
|
|
187
|
+
| `browser` | `com.webos.app.browser` |
|
|
188
|
+
|
|
189
|
+
### Open URL
|
|
190
|
+
|
|
191
|
+
Send a URL to the TV to open in the built-in webOS browser.
|
|
192
|
+
|
|
193
|
+
| Command | Description |
|
|
194
|
+
|---------|-------------|
|
|
195
|
+
| `lgtv open-url https://example.com` | Open URL in TV browser |
|
|
196
|
+
| `lgtv open-url example.com` | Scheme is added automatically if omitted |
|
|
197
|
+
|
|
198
|
+
### Number Keys
|
|
199
|
+
|
|
200
|
+
| Command | Description |
|
|
201
|
+
|---------|-------------|
|
|
202
|
+
| `lgtv number <0-9>` | Send a number key press |
|
|
203
|
+
|
|
204
|
+
### Display & Settings (newer TVs only)
|
|
205
|
+
|
|
206
|
+
These commands use `setSystemSettings` which may not be available on older webOS versions.
|
|
207
|
+
|
|
208
|
+
| Command | Description |
|
|
209
|
+
|---------|-------------|
|
|
210
|
+
| `lgtv screen-off` | Turn off screen (audio continues) |
|
|
211
|
+
| `lgtv screen-on` | Turn screen back on |
|
|
212
|
+
| `lgtv picture-mode <mode>` | Set picture mode (e.g., standard, vivid, cinema, game) |
|
|
213
|
+
| `lgtv sound-mode <mode>` | Set sound mode (e.g., standard, cinema, game) |
|
|
214
|
+
| `lgtv subtitles` | Toggle subtitles |
|
|
215
|
+
| `lgtv audio-track` | Cycle audio track |
|
|
216
|
+
|
|
217
|
+
### Service Menus (Advanced)
|
|
218
|
+
|
|
219
|
+
These menus require a password. The default is usually **0413**. Other common codes: **0000**, **7777**.
|
|
220
|
+
|
|
221
|
+
| Command | Description |
|
|
222
|
+
|---------|-------------|
|
|
223
|
+
| `lgtv service instart` | Open In-Start service menu |
|
|
224
|
+
| `lgtv service ezadjust` | Open Ez-Adjust menu |
|
|
225
|
+
| `lgtv service hotel` | Open Hotel/Installation mode |
|
|
226
|
+
| `lgtv service hidden` | Open hidden menu |
|
|
227
|
+
| `lgtv service freesync` | Show Freesync info |
|
|
228
|
+
|
|
229
|
+
### Raw Commands
|
|
230
|
+
|
|
231
|
+
| Command | Description |
|
|
232
|
+
|---------|-------------|
|
|
233
|
+
| `lgtv raw <ssap-uri>` | Send any SSAP command |
|
|
234
|
+
| `lgtv raw <ssap-uri> --payload '{"key":"value"}'` | Send with JSON payload |
|
|
235
|
+
|
|
236
|
+
#### Examples
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Get system info
|
|
240
|
+
lgtv raw ssap://system/getSystemInfo
|
|
241
|
+
|
|
242
|
+
# Get software info
|
|
243
|
+
lgtv raw ssap://com.webos.service.update/getCurrentSWInformation
|
|
244
|
+
|
|
245
|
+
# Set a specific setting
|
|
246
|
+
lgtv raw ssap://com.webos.service.settings/setSystemSettings \
|
|
247
|
+
--payload '{"category":"picture","settings":{"backlight":80}}'
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Using with Multiple TVs
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Add multiple TVs
|
|
254
|
+
lgtv add 192.168.1.100 --name "Living Room"
|
|
255
|
+
lgtv add 192.168.1.101 --name "Bedroom"
|
|
256
|
+
|
|
257
|
+
# Set default
|
|
258
|
+
lgtv set-default 192.168.1.100
|
|
259
|
+
|
|
260
|
+
# Commands use default TV
|
|
261
|
+
lgtv off
|
|
262
|
+
|
|
263
|
+
# Override with --tv flag
|
|
264
|
+
lgtv --tv 192.168.1.101 off
|
|
265
|
+
lgtv --tv 192.168.1.101 launch netflix
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Using with AI Assistants
|
|
269
|
+
|
|
270
|
+
This CLI is designed to be easily used by AI assistants and automation tools. Run `lgtv -h` for the full command list, or `lgtv <command> -h` for detailed help on any command.
|
|
271
|
+
|
|
272
|
+
Key patterns:
|
|
273
|
+
- All commands return human-readable output to stdout
|
|
274
|
+
- Errors go to stderr with non-zero exit codes
|
|
275
|
+
- `lgtv apps` and `lgtv inputs` list available options with IDs
|
|
276
|
+
- `lgtv raw` allows sending any SSAP command for capabilities not covered by named commands
|
|
277
|
+
|
|
278
|
+
## Network Requirements
|
|
279
|
+
|
|
280
|
+
- Your computer and TV must be on the same local network
|
|
281
|
+
- Port 3001 (WSS) must be accessible for TV control
|
|
282
|
+
- Port 3000 (HTTP) is used for device discovery enrichment
|
|
283
|
+
- Port 1900 (UDP) is used for SSDP discovery
|
|
284
|
+
- Ports 7 and 9 (UDP broadcast) are used for Wake-on-LAN
|
|
285
|
+
|
|
286
|
+
## License
|
|
287
|
+
|
|
288
|
+
MIT
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# LG TV Remote CLI
|
|
2
|
+
|
|
3
|
+
## Command-line interface for controlling LG webOS TVs over your local network.
|
|
4
|
+
|
|
5
|
+
Communicates via WebSocket using the SSAP (Simple Service Access Protocol) on port 3001. Supports TV discovery, PIN-based pairing, remote control, app launching, input switching, Wake-on-LAN, and more.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Only Python 3.9+ is required (ships with macOS and most Linux distros).
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Clone the repo
|
|
13
|
+
git clone https://github.com/griches/lgtvremote-cli.git
|
|
14
|
+
cd lgtvremote-cli
|
|
15
|
+
|
|
16
|
+
# Option 1: Add a shell alias (recommended)
|
|
17
|
+
echo 'alias lgtv="python3 '$(pwd)'/lgtvremote_cli.py"' >> ~/.zshrc
|
|
18
|
+
source ~/.zshrc
|
|
19
|
+
|
|
20
|
+
# Option 2: Symlink into your PATH
|
|
21
|
+
ln -s $(pwd)/lgtvremote_cli.py /usr/local/bin/lgtv
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If you don't have Python 3 installed:
|
|
25
|
+
|
|
26
|
+
| Platform | Install |
|
|
27
|
+
|----------|---------|
|
|
28
|
+
| macOS | `brew install python3` |
|
|
29
|
+
| Ubuntu/Debian | `sudo apt install python3` |
|
|
30
|
+
| Fedora/RHEL | `sudo dnf install python3` |
|
|
31
|
+
| Windows | `winget install Python.Python.3` or [python.org](https://www.python.org/downloads/) |
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# 1. Scan, add, and pair — all in one step
|
|
37
|
+
lgtv scan
|
|
38
|
+
# Finds TVs, adds them, asks to pair, fetches MAC addresses for Wake-on-LAN
|
|
39
|
+
|
|
40
|
+
# 2. Control your TV
|
|
41
|
+
lgtv off # Turn off
|
|
42
|
+
lgtv on # Wake via Wake-on-LAN
|
|
43
|
+
lgtv launch Netflix # Launch apps by name
|
|
44
|
+
lgtv volume set 20 # Set volume
|
|
45
|
+
lgtv input 1 # Switch to HDMI 1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or if you know the IP:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
lgtv add 192.168.1.100 # Adds, pairs, and fetches MACs automatically
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
Device data is stored in `~/.config/lgtvremote/devices.json`. This includes IP addresses, names, MAC addresses, and pairing keys.
|
|
57
|
+
|
|
58
|
+
## Command Reference
|
|
59
|
+
|
|
60
|
+
### Device Management
|
|
61
|
+
|
|
62
|
+
| Command | Description |
|
|
63
|
+
|---------|-------------|
|
|
64
|
+
| `lgtv scan` | Discover TVs, auto-add, pair, and fetch MAC addresses |
|
|
65
|
+
| `lgtv add <ip>` | Add a TV by IP — auto-enriches, pairs, and fetches MACs |
|
|
66
|
+
| `lgtv add <ip> --name "Living Room"` | Add with a custom name |
|
|
67
|
+
| `lgtv remove <ip>` | Remove a saved TV |
|
|
68
|
+
| `lgtv list` | List all saved TVs |
|
|
69
|
+
| `lgtv set-default <ip>` | Set the default TV for commands |
|
|
70
|
+
| `lgtv pair` | Re-pair with a TV (if needed) |
|
|
71
|
+
| `lgtv enrich` | Re-fetch model name and MAC addresses from TV |
|
|
72
|
+
|
|
73
|
+
### Power
|
|
74
|
+
|
|
75
|
+
| Command | Description |
|
|
76
|
+
|---------|-------------|
|
|
77
|
+
| `lgtv on` | Turn on TV via Wake-on-LAN (requires stored MAC address) |
|
|
78
|
+
| `lgtv off` | Turn off TV |
|
|
79
|
+
| `lgtv power` | Toggle power (off via WebSocket, on via WOL if unreachable) |
|
|
80
|
+
|
|
81
|
+
### Volume
|
|
82
|
+
|
|
83
|
+
| Command | Description |
|
|
84
|
+
|---------|-------------|
|
|
85
|
+
| `lgtv volume up` | Volume up |
|
|
86
|
+
| `lgtv volume down` | Volume down |
|
|
87
|
+
| `lgtv volume set <0-100>` | Set volume to specific level |
|
|
88
|
+
| `lgtv volume get` | Get current volume and mute status |
|
|
89
|
+
| `lgtv volume mute` | Mute |
|
|
90
|
+
| `lgtv volume unmute` | Unmute |
|
|
91
|
+
|
|
92
|
+
### Navigation
|
|
93
|
+
|
|
94
|
+
| Command | Description |
|
|
95
|
+
|---------|-------------|
|
|
96
|
+
| `lgtv nav up` | Navigate up |
|
|
97
|
+
| `lgtv nav down` | Navigate down |
|
|
98
|
+
| `lgtv nav left` | Navigate left |
|
|
99
|
+
| `lgtv nav right` | Navigate right |
|
|
100
|
+
| `lgtv nav ok` | Select / OK / Enter |
|
|
101
|
+
| `lgtv nav back` | Go back |
|
|
102
|
+
| `lgtv nav home` | Go to home screen |
|
|
103
|
+
| `lgtv nav menu` | Open menu |
|
|
104
|
+
|
|
105
|
+
### Channels
|
|
106
|
+
|
|
107
|
+
| Command | Description |
|
|
108
|
+
|---------|-------------|
|
|
109
|
+
| `lgtv channel up` | Next channel |
|
|
110
|
+
| `lgtv channel down` | Previous channel |
|
|
111
|
+
| `lgtv channel set <number>` | Switch to specific channel |
|
|
112
|
+
|
|
113
|
+
### Media Controls
|
|
114
|
+
|
|
115
|
+
| Command | Description |
|
|
116
|
+
|---------|-------------|
|
|
117
|
+
| `lgtv play` | Play |
|
|
118
|
+
| `lgtv pause` | Pause |
|
|
119
|
+
| `lgtv stop` | Stop playback |
|
|
120
|
+
| `lgtv rewind` | Rewind |
|
|
121
|
+
| `lgtv ff` | Fast forward |
|
|
122
|
+
| `lgtv skip-forward` | Skip forward / next track |
|
|
123
|
+
| `lgtv skip-back` | Skip backward / previous track |
|
|
124
|
+
|
|
125
|
+
### Input / HDMI
|
|
126
|
+
|
|
127
|
+
| Command | Description |
|
|
128
|
+
|---------|-------------|
|
|
129
|
+
| `lgtv input 1` | Switch to HDMI 1 |
|
|
130
|
+
| `lgtv input 2` | Switch to HDMI 2 |
|
|
131
|
+
| `lgtv input HDMI_3` | Switch to HDMI 3 (full ID) |
|
|
132
|
+
| `lgtv inputs` | List all available inputs |
|
|
133
|
+
|
|
134
|
+
### Apps
|
|
135
|
+
|
|
136
|
+
Launch any app by its display name — matches against what's installed on your TV:
|
|
137
|
+
|
|
138
|
+
| Command | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| `lgtv launch Netflix` | Launch Netflix |
|
|
141
|
+
| `lgtv launch YouTube` | Launch YouTube |
|
|
142
|
+
| `lgtv launch "Disney+"` | Launch Disney+ |
|
|
143
|
+
| `lgtv launch "Prime Video"` | Launch Prime Video |
|
|
144
|
+
| `lgtv launch Plex` | Launch Plex |
|
|
145
|
+
| `lgtv launch browser` | Launch web browser (shortcut) |
|
|
146
|
+
| `lgtv launch settings` | Open TV settings (shortcut) |
|
|
147
|
+
| `lgtv launch <app-id>` | Launch by webOS app ID |
|
|
148
|
+
| `lgtv apps` | List all installed apps with their IDs |
|
|
149
|
+
| `lgtv app` | Show currently running foreground app |
|
|
150
|
+
|
|
151
|
+
#### Supported App Shortcuts
|
|
152
|
+
|
|
153
|
+
| Shortcut | App ID |
|
|
154
|
+
|----------|--------|
|
|
155
|
+
| `netflix` | `netflix` |
|
|
156
|
+
| `youtube` | `youtube.leanback.v4` |
|
|
157
|
+
| `amazon` / `prime` / `primevideo` | `amazon` |
|
|
158
|
+
| `disney` / `disney+` / `disneyplus` | `com.disney.disneyplus-prod` |
|
|
159
|
+
| `hulu` | `hulu` |
|
|
160
|
+
| `hbo` / `hbomax` | `hbo-go-2` |
|
|
161
|
+
| `apple` / `appletv` | `com.apple.tv` |
|
|
162
|
+
| `spotify` | `spotify-beehive` |
|
|
163
|
+
| `plex` | `plex` |
|
|
164
|
+
| `crunchyroll` | `crunchyroll` |
|
|
165
|
+
| `twitch` | `twitch` |
|
|
166
|
+
| `vudu` | `vudu` |
|
|
167
|
+
| `livetv` / `tv` | `com.webos.app.livetv` |
|
|
168
|
+
| `settings` | `com.webos.app.settings` |
|
|
169
|
+
| `browser` | `com.webos.app.browser` |
|
|
170
|
+
|
|
171
|
+
### Open URL
|
|
172
|
+
|
|
173
|
+
Send a URL to the TV to open in the built-in webOS browser.
|
|
174
|
+
|
|
175
|
+
| Command | Description |
|
|
176
|
+
|---------|-------------|
|
|
177
|
+
| `lgtv open-url https://example.com` | Open URL in TV browser |
|
|
178
|
+
| `lgtv open-url example.com` | Scheme is added automatically if omitted |
|
|
179
|
+
|
|
180
|
+
### Number Keys
|
|
181
|
+
|
|
182
|
+
| Command | Description |
|
|
183
|
+
|---------|-------------|
|
|
184
|
+
| `lgtv number <0-9>` | Send a number key press |
|
|
185
|
+
|
|
186
|
+
### Display & Settings (newer TVs only)
|
|
187
|
+
|
|
188
|
+
These commands use `setSystemSettings` which may not be available on older webOS versions.
|
|
189
|
+
|
|
190
|
+
| Command | Description |
|
|
191
|
+
|---------|-------------|
|
|
192
|
+
| `lgtv screen-off` | Turn off screen (audio continues) |
|
|
193
|
+
| `lgtv screen-on` | Turn screen back on |
|
|
194
|
+
| `lgtv picture-mode <mode>` | Set picture mode (e.g., standard, vivid, cinema, game) |
|
|
195
|
+
| `lgtv sound-mode <mode>` | Set sound mode (e.g., standard, cinema, game) |
|
|
196
|
+
| `lgtv subtitles` | Toggle subtitles |
|
|
197
|
+
| `lgtv audio-track` | Cycle audio track |
|
|
198
|
+
|
|
199
|
+
### Service Menus (Advanced)
|
|
200
|
+
|
|
201
|
+
These menus require a password. The default is usually **0413**. Other common codes: **0000**, **7777**.
|
|
202
|
+
|
|
203
|
+
| Command | Description |
|
|
204
|
+
|---------|-------------|
|
|
205
|
+
| `lgtv service instart` | Open In-Start service menu |
|
|
206
|
+
| `lgtv service ezadjust` | Open Ez-Adjust menu |
|
|
207
|
+
| `lgtv service hotel` | Open Hotel/Installation mode |
|
|
208
|
+
| `lgtv service hidden` | Open hidden menu |
|
|
209
|
+
| `lgtv service freesync` | Show Freesync info |
|
|
210
|
+
|
|
211
|
+
### Raw Commands
|
|
212
|
+
|
|
213
|
+
| Command | Description |
|
|
214
|
+
|---------|-------------|
|
|
215
|
+
| `lgtv raw <ssap-uri>` | Send any SSAP command |
|
|
216
|
+
| `lgtv raw <ssap-uri> --payload '{"key":"value"}'` | Send with JSON payload |
|
|
217
|
+
|
|
218
|
+
#### Examples
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Get system info
|
|
222
|
+
lgtv raw ssap://system/getSystemInfo
|
|
223
|
+
|
|
224
|
+
# Get software info
|
|
225
|
+
lgtv raw ssap://com.webos.service.update/getCurrentSWInformation
|
|
226
|
+
|
|
227
|
+
# Set a specific setting
|
|
228
|
+
lgtv raw ssap://com.webos.service.settings/setSystemSettings \
|
|
229
|
+
--payload '{"category":"picture","settings":{"backlight":80}}'
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Using with Multiple TVs
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Add multiple TVs
|
|
236
|
+
lgtv add 192.168.1.100 --name "Living Room"
|
|
237
|
+
lgtv add 192.168.1.101 --name "Bedroom"
|
|
238
|
+
|
|
239
|
+
# Set default
|
|
240
|
+
lgtv set-default 192.168.1.100
|
|
241
|
+
|
|
242
|
+
# Commands use default TV
|
|
243
|
+
lgtv off
|
|
244
|
+
|
|
245
|
+
# Override with --tv flag
|
|
246
|
+
lgtv --tv 192.168.1.101 off
|
|
247
|
+
lgtv --tv 192.168.1.101 launch netflix
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Using with AI Assistants
|
|
251
|
+
|
|
252
|
+
This CLI is designed to be easily used by AI assistants and automation tools. Run `lgtv -h` for the full command list, or `lgtv <command> -h` for detailed help on any command.
|
|
253
|
+
|
|
254
|
+
Key patterns:
|
|
255
|
+
- All commands return human-readable output to stdout
|
|
256
|
+
- Errors go to stderr with non-zero exit codes
|
|
257
|
+
- `lgtv apps` and `lgtv inputs` list available options with IDs
|
|
258
|
+
- `lgtv raw` allows sending any SSAP command for capabilities not covered by named commands
|
|
259
|
+
|
|
260
|
+
## Network Requirements
|
|
261
|
+
|
|
262
|
+
- Your computer and TV must be on the same local network
|
|
263
|
+
- Port 3001 (WSS) must be accessible for TV control
|
|
264
|
+
- Port 3000 (HTTP) is used for device discovery enrichment
|
|
265
|
+
- Port 1900 (UDP) is used for SSDP discovery
|
|
266
|
+
- Ports 7 and 9 (UDP broadcast) are used for Wake-on-LAN
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
MIT
|