Skip to main content

Client for the LG Smart TV running NetCast 3 or 4.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylgnetcast-0.3.9.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

pylgnetcast-0.3.9-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file pylgnetcast-0.3.9.tar.gz.

File metadata

  • Download URL: pylgnetcast-0.3.9.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for pylgnetcast-0.3.9.tar.gz
Algorithm Hash digest
SHA256 22fc2f4fb7c1e606c7950bcd78df96d65c77f82199b9495f40aab5f44d0522fb
MD5 de3aea4fda763b567123c3d73525b8d8
BLAKE2b-256 adbadeb9f1943487086ab899b8b67577c619c82811f2c99e301dbd0f6528df54

See more details on using hashes here.

File details

Details for the file pylgnetcast-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: pylgnetcast-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for pylgnetcast-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3c362d14408437050311bd5199eee153544e7263f94a0a1222c9212589cdae59
MD5 7844e4e4bc1bc096d1e3d861ae82ab09
BLAKE2b-256 40aba740fd910d7aaca1b9c173c53fdd3d3845e37f8265eb071cca2ba9cf1b9f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page