lgtv-companion-linux
Keep LG webOS TVs in sync with your Linux PC's power state: automatic power on/off with boot, shutdown, suspend and resume; screen blanking on user idle; HDMI input management; Wake-on-LAN; and a CLI exposing the full webOS control surface (picture, sound, inputs, buttons, luna settings).
A feature-parity Linux port of the excellent LGTV Companion for Windows by Jörgen Persson — designed to work on immutable distributions such as Bazzite (Fedora Atomic) as well as regular desktops.
How it works
| Component | Runs as | Job |
|---|---|---|
lgtvc-daemon |
system service | Owns TV websocket sessions and pairing keys; boot power-on; Wake-on-LAN; wake-on-input; user-idle blanking + vetoes; remote-stream + lock reactions; display topology; IPC socket for the CLI and scripting. (Suspend/resume and shutdown are handled by short-lived lgtvc-sleep/lgtvc-shutdown oneshot units, not in-daemon.) |
lgtvc-agent |
user service | Session-side eyes: input activity, MPRIS playback, KWin fullscreen, screen-lock and streaming-process detection — things the confined system daemon can't see — reported over IPC |
lgtvc |
CLI | The full ~115-command surface, LGTVcli-compatible syntax; status/reload/events; talks to the daemon, or straight to the TV with --direct |
lgtvc-tray |
user service (optional) | PySide6 tray + settings dialog ([tray] extra) |
lgtvc-mqtt |
system service (optional) | MQTT / Home Assistant bridge ([mqtt] extra) |
Reboot vs shutdown is detected deterministically via systemd
(PrepareForShutdownWithMetadata + a Conflicts=reboot.target fallback unit):
a reboot leaves the TV on, a shutdown powers it off. No localized-string
matching like on Windows.
Before an automatic power-off the daemon checks which input the TV is showing
(getForegroundAppInfo): if someone is watching another HDMI source or an
app, the TV is left alone.
Install (system mode, works on ostree/immutable distros)
sudo python3 -m venv /usr/local/lib/lgtv-companion
sudo /usr/local/lib/lgtv-companion/bin/pip install lgtvcompanion # or a git checkout
sudo ln -s /usr/local/lib/lgtv-companion/bin/lgtvc{,-daemon} /usr/local/bin/
sudo lgtvc setup install --mode system --service-user $USER
sudo lgtvc setup pair --host <tv-ip> # approve the prompt on the TV
sudo systemctl enable --now lgtvc-daemon lgtvc-shutdown
systemctl --user enable --now lgtvc-agent
Nothing touches /usr (the venv lives in /usr/local = /var/usrlocal on
ostree); units live in /etc/systemd/system, config in
/etc/lgtv-companion/config.json, pairing keys in
/var/lib/lgtv-companion/keys/.
Migrating from Windows? lgtvc setup import-windows --file config.json
converts your existing settings including device session keys (no re-pairing).
CLI
lgtvc -poweron # all devices
lgtvc -backlight 80 -mute LivingRoom # several commands, device by name
lgtvc -sethdmi 2
lgtvc -picturemode filmMaker -energysaving off
lgtvc -button INFO
lgtvc -get_system_settings picture '["backlight","contrast"]'
lgtvc -output friendly -request com.webos.service.tvpower/power/getPowerState
lgtvc events # stream SYSTEM_* events for scripting
Same syntax as the Windows LGTVcli: commands are case-insensitive, several
per invocation, trailing bare words select devices (none = all).
Feature parity vs upstream (Windows)
| Upstream feature | Here |
|---|---|
| Power sync: boot / shutdown / reboot / suspend / resume | ✅ via logind + systemd (reboot detection is deterministic, an improvement) |
| Wake-on-LAN (broadcast / subnet / directed / auto, multi-MAC) | ✅ |
| HDMI source-safety guard on power-off | ✅ |
| Set HDMI input on power-on (with delay) | ✅ |
| User-idle screen blank + mute, ignored keys, process list | ✅ (evdev instead of Raw Input) |
| Fullscreen / "video wake lock" idle vetoes | ✅ MPRIS playback + logind idle inhibitors + KWin fullscreen |
| Full settings CLI (picture/sound/inputs/ambient/service-menu/Flex) | ✅ 74 luna settings vendored from upstream, identical names and values |
| Virtual remote buttons | ✅ (pointer-input socket) |
| webOS 2025/2026 pairing (blacklisted-manifest fix) | ✅ signature-free generic manifest (issue #351) |
| Multiple TVs | ✅ |
| Display-topology mode | ✅ DRM/EDID (lgtvc setup map-display) |
| Remote-stream detection | ✅ Sunshine/Apollo (log) + Parsec/CRD/etc. (process watch) + -streaming_connect/_disconnect hooks |
| Session lock/unlock → TV | ✅ blank/off on screen lock (on_lock/on_unlock) |
| External scripting API | ✅ unix socket, same SYSTEM_* event names (was: named pipe) |
| MQTT / Home Assistant | ✅ optional bridge with HA auto-discovery (docs) — a first-party integration upstream lacks |
| Settings GUI + tray | ✅ PySide6 tray + settings dialog ([tray] extra) |
| Auto-updater (MSI) | not applicable — use pip/pipx; version check planned |
| RDP detection, NIC LUID binding, locale word lists | not applicable on Linux |
Documentation
- Install — system & user modes, ostree/SELinux notes
- MQTT / Home Assistant — bridge + HA auto-discovery
- Migration — from Windows or a hand-rolled setup
- External API — event stream + scripting
- Parity matrix — vs the Windows app
- Troubleshooting — EACCES, WoL, suspend, and more
License
MIT. Portions of the design and the command/button tables are derived from LGTV Companion, © Jörgen Persson, MIT.
Release files for lgtvcompanion 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lgtvcompanion-0.2.0.tar.gz | 89.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lgtvcompanion-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 173.6 kB
Release files / lgtvcompanion-0.2.0.tar.gz
| Download URL | lgtvcompanion-0.2.0.tar.gz |
|---|---|
| Size | 89.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb0e809aadad34a41fbc1581eb9a9ee4d05458954c5ace15d840416f68d0f5e8
|
|
BLAKE2b-256 checksum How to use checksums |
1f317b3a97ee0f2d16204b31bd6ed8a6807d054f745cb7f14176f4c0365eca8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / lgtvcompanion-0.2.0-py3-none-any.whl
| Download URL | lgtvcompanion-0.2.0-py3-none-any.whl |
|---|---|
| Size | 84.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81132e726d696d15c1c194d5f2b4a2848c1b9da5953284c183a62516f54d9c83
|
|
BLAKE2b-256 checksum How to use checksums |
a8fd4c40577c1d7ce5f1b0a2c6448fa84a57096ed7228b9302ebe03be8650997
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|