Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

pylgnetcast

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pylgnetcast

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

pipPyPI
Version
0.3.9
Maintainers
1

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

  • Python 3
  • requests package.

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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts