SkillAgentSearch skills...

Lgpowercontrol

LGPowerControl

Install / Use

/learn @bassidus/Lgpowercontrol
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

LGPowerControl

Designed for setups where an LG TV is used as a computer monitor. Unlike regular monitors, TVs don't respond naturally to the computer's power state. This script bridges that gap by automatically turning the TV on at boot and off at shutdown, and blanking/unblanking the screen when the computer display sleeps or wakes.

Compatible with Debian-based (Ubuntu, Mint), Fedora-based, and Arch-based (EndeavourOS, Manjaro) systems.

Especially useful for OLED users looking to reduce burn-in risk.


Requirements

  • Linux with systemd
  • LG TV with WebOS (e.g., CX, C1–C4 OLED)
  • iproute2, and wakeonlan (Debian/Arch) or net-tools for ether-wake (Fedora)
  • Python 3 with python3-venv (required on Debian-based systems)

Installation

1. Prepare the TV

  1. Power on the TV and connect it to your network.
  2. Enable Wake-on-LAN:
    • CX: Settings → All Settings → Connection → Mobile Connection Management → TV On with Mobile
    • C1–C4: All Settings → General → Devices → External Devices → TV On With Mobile → Turn on via Wi-Fi
    • Required even when using a wired Ethernet connection.
  3. Recommended: Set a static DHCP lease for the TV in your router so its IP doesn't change.

2. Run the Installer

git clone https://github.com/bassidus/lgpowercontrol.git
cd lgpowercontrol
./install.sh 192.168.X.X

The IP address is optional — the installer will prompt for it if omitted. Root access is requested automatically via sudo.

What the installer does

  • Detects your package manager (apt, dnf, pacman) and provides install hints for any missing dependencies
  • Pings the TV and retrieves its MAC address from the ARP table
  • Prompts for an HDMI port (1–5) so the TV switches to the right input on power-on
  • Prompts for power mode (see Configuration)
  • Installs bscpylgtv into a dedicated Python venv at /opt/lgpowercontrol/bscpylgtv
  • Installs and enables three systemd services for boot, shutdown, and screen sleep/wake
  • Writes /opt/lgpowercontrol/lgpowercontrol.conf from the template in the repo
  • Triggers a one-time pairing request on the TV — accept it with the remote

Configuration

All settings live in /opt/lgpowercontrol/lgpowercontrol.conf. The repo contains lgpowercontrol.conf.template showing the full format with defaults.

After editing, restart the monitor service to apply changes:

sudo systemctl restart lgpowercontrol-monitor.service

Boot and shutdown services read the config each time they run — no restart needed for those.

Hardware (refreshed automatically on reinstall)

| Variable | Description | |---|---| | LGTV_IP | TV IP address | | LGTV_MAC | TV MAC address | | WOL_CMD | Wake-on-LAN command | | HDMI_INPUT | HDMI port to switch to on power-on (empty to skip) |

Behavior

| Variable | Options | Default | Description | |---|---|---|---| | BOOT_SHUTDOWN_MODE | power, screen | power | power: WoL on at boot, power off at shutdown. screen: screen on/off only (TV stays in standby) | | MONITOR_MODE | power, screen | power | power: full power off/on when display sleeps/wakes. screen: screen off/on only |


Screen State Monitor

Installed automatically as lgpowercontrol-monitor.service.

  • System service: Runs independently of which user is logged in. Works in multi-user setups.
  • DE-agnostic: Works with GNOME, KDE Plasma, Cinnamon, and others on both X11 and Wayland.
  • Detection: Polls DPMS state from the kernel DRM subsystem (/sys/class/drm/) every 2 seconds. Falls back to logind IdleHint when DRM sysfs is unavailable.

Uninstallation

./uninstall.sh

Stops and removes all systemd services (including any legacy services from older versions) and /opt/lgpowercontrol.


Notes

  • Logs: journalctl -t lgpowercontrol
  • Tested on: Ubuntu 25.04, Fedora 43, EndeavourOS and CachyOS (April 2026) with an LG OLED42C35LA

Credits

View on GitHub
GitHub Stars20
CategoryDevelopment
Updated8h ago
Forks0

Languages

Shell

Security Score

85/100

Audited on Apr 6, 2026

No findings