I needed to be able to control an LG TV via the network, these days everything has “smart” in it’s title so I did some digging and found a few attempts to use the LG websocket to control the TV. After a little reverse engineering, re-engineering and a lot of debugging I’ve produced a simple command line tool (and python module) for controlling webOS 4.0 TVs.
Now I assume that this would also work on other network connected LG devices so please get in touch and let me know if you have other hardware that LG put out that probably runs on WebOS.
Unlike a lot of existing python libraries and tools for controlling the LG webOS series of Smart TVs this tool works using the websocket rather than the HTTP service. My TV (a 2016~ model) doesn’t have a HTTP service and only provides the websocket on port 3000.
The TV reports webos version 4.x.
It’s actually pretty incredible just how much functionality is exposed via this protocol, I plan to make a pipy module for this so you’ll be able to incorporate functionality into other python apps. It would also make sense to support other brands eventually, so if you have a TV with Wifi or Ethernet and think it has some kind of control available over the network get in touch and we might be able to do some work to figure out how to control it 🙂
LG WebOS Support Contact