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.
It makes use of bscpylgtv to control the TV set. It is included in this repository for Apple Silicon but can easily be compiled for Intel if desired.
- For the best result, make sure you configure your TV for PC use. This video is a great place to start.
- Make sure Wake on LAN is enabled in your TV settings. Settings > Support > IP Control Settings > Wake on LAN = ENABLED.
Use the installation script for a simple and convenient installation process.
Before proceeding, make sure you have Homebrew installed.
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.shEdit ~/.hammerspoon/lgtv.lua to customize the script's behavior:
tv_input— Set this to the HDMI port your Mac is connected to (e.g.,"HDMI_1","HDMI_2","HDMI_3","HDMI_4"). Default is"HDMI_1".screen_off_command— Set to"power_off"to fully turn off the TV when your Mac sleeps. Default is"screen_off", which only blanks the display.debug— Set totrueto enable debug logging if you are running into issues.
This new and updated version no longer uses LGWebOSRemote, and does not require installing Python. It is therefore much easier to get going. 🎉