Skip to main content

Python LG Netcast

A Python 3 library and command line tool to control LG Smart TV running NetCast 3.0 (LG Smart TV models released in 2012) and NetCast 4.0 (LG Smart TV models released in 2013) via TCP/IP.

This library was forked from wokar/pylgnetcast and is primarily being developed with the intent of supporting home-assistant.

Dependencies

API Usage

from xml.etree import ElementTree
from pylgnetcast import LgNetCastClient, LG_COMMAND, LG_QUERY

with LgNetCastClient('192.168.1.5', '889955') as client:
    client.send_command(LG_COMMAND.MUTE_TOGGLE)
    data = client.query_data(LG_QUERY.VOLUME_INFO)
    if data:
        print(ElementTree.tostring(data[0], encoding='unicode'))

Command Line Tool

PyLgNetCast also provides a simple command line tool to remote control a TV.

The tool needs a pairing key to be allowed to send commands to your TV. To get the pairing key just start the tool while your TV is on:

python -m pylgnetcast --host <IP of your TV>

This will display the pairing key on your TV.

To retrieve status information from your TV start the tool like:

python -m pylgnetcast --host <IP of your TV>  --pairing_key <pairing key of your TV>

This will display information about the current channel, volume, 3D mode, etc. retrieved from your TV.

If you want to send a command to your TV, for instance to turn the volume up, check the list of available commands in the pylgnetcast.py file. The class LG_COMMAND defines all supported commands and volume up would be defined as 24.

python -m pylgnetcast --host <IP of your TV>  --pairing_key <pairing key of your TV> --command 24

Metadata

Release files for pylgnetcast 0.3.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylgnetcast 0.3.9
File Size Uploaded
pylgnetcast-0.3.9.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylgnetcast 0.3.9
File Interpreter ABI Platform
pylgnetcast-0.3.9-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / pylgnetcast-0.3.9.tar.gz

Download URL pylgnetcast-0.3.9.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
22fc2f4fb7c1e606c7950bcd78df96d65c77f82199b9495f40aab5f44d0522fb
BLAKE2b-256 checksum
How to use checksums
adbadeb9f1943487086ab899b8b67577c619c82811f2c99e301dbd0f6528df54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / pylgnetcast-0.3.9-py3-none-any.whl

Download URL pylgnetcast-0.3.9-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c362d14408437050311bd5199eee153544e7263f94a0a1222c9212589cdae59
BLAKE2b-256 checksum
How to use checksums
40aba740fd910d7aaca1b9c173c53fdd3d3845e37f8265eb071cca2ba9cf1b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.3.9 This release

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

1 release file

0.3.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page