/lg-tv-control-macos

Automatically wake/sleep and change the input of your LG TV when used as a monitor on macOS

Primary LanguageLua

LG TV Control for macOS

Automatically wake/sleep and change the input of your LG TV when used as a monitor on macOS.

This script uses Hammerspoon to detect system events such as power off, sleep, and wake.

Pre-installation Requirements

Installation

Use the installation script for a simple and convenient installation process.

Before proceeding, make sure you have Homebrew installed. All the other dependencies will be installed automatically:

Run the following commands in Terminal:

cd /tmp
git clone https://github.com/cmer/lg-tv-control-macos.git
cd lg-tv-control-macos
./install.sh

Removing old versions of LGWebOSRemote

If you had previously installed LGWebOSRemote with PIP, you can remove the old version by running:

rm -fr ~/opt/lgtv

Configuring LGWebOSRemote

By now, you should be able to run

~/bin/lgtv scan ssl

and see some info about your TV. Grab your TV's IP address from the output. Then:

~/bin/lgtv auth <ip_address_here> MyTV --ssl

and follow the instructions on your TV.

Now, try the following:

~/bin/lgtv --name MyTV --ssl swInfo
~/bin/lgtv --name MyTV --ssl screenOff

If everything is working as expected, your screen should turn off.

Change the HDMI input at the top of ~/.hammerspoon/init_lgtv.lua script, if needed.

Special Thanks

Thanks to @greyshi for extending upon my initial Wake On LAN gist and introducing LGWebOSRemote.