Skip to main content

Library to control webOS based LG TV devices

Project description

aiowebostv

Python library to control LG webOS based TV devices.

Based on:

Requirements

  • Python >= 3.9

Install

pip install aiowebostv

Install from Source

Run the following command inside this folder

pip install --upgrade .

Examples

Basic Example:

import asyncio

from aiowebostv import WebOsClient

HOST = "192.168.1.39"
# For first time pairing set key to None
CLIENT_KEY = "140cce792ae045920e14da4daa414582"


async def main():
    """Basic webOS client example."""

    client = WebOsClient(HOST, CLIENT_KEY)
    await client.connect()

    # Store this key for future use
    print(f"Client key: {client.client_key}")

    apps = await client.get_apps_all()
    for app in apps:
        print(app)

    await client.disconnect()


if __name__ == "__main__":
    asyncio.run(main())

Subscribed State Updates Example:

import asyncio

from aiowebostv import WebOsClient

HOST = "192.168.1.39"
# For first time pairing set key to None
CLIENT_KEY = "140cce792ae045920e14da4daa414582"


async def on_state_change(client):
    """State changed callback."""
    print("State changed:")
    print(f"System info: {client.system_info}")
    print(f"Software info: {client.software_info}")
    print(f"Hello info: {client.hello_info}")
    print(f"Channel info: {client.channel_info}")
    print(f"Apps: {client.apps}")
    print(f"Inputs: {client.inputs}")
    print(f"Powered on: {client.power_state}")
    print(f"App Id: {client.current_app_id}")
    print(f"Channels: {client.channels}")
    print(f"Current channel: {client.current_channel}")
    print(f"Muted: {client.muted}")
    print(f"Volume: {client.volume}")
    print(f"Sound output: {client.sound_output}")


async def main():
    """Subscribed State Updates Example."""
    client = WebOsClient(HOST, CLIENT_KEY)
    await client.register_state_update_callback(on_state_change)
    await client.connect()

    # Store this key for future use
    print(f"Client key: {client.client_key}")

    # Change something using the remote during sleep period to get updates
    await asyncio.sleep(30)

    await client.disconnect()


if __name__ == "__main__":
    asyncio.run(main())

Examples can be found in the examples folder

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

aiowebostv-0.4.2.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

aiowebostv-0.4.2-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file aiowebostv-0.4.2.tar.gz.

File metadata

  • Download URL: aiowebostv-0.4.2.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for aiowebostv-0.4.2.tar.gz
Algorithm Hash digest
SHA256 099fc2bbc2bda0f75c6c10ae7f627529b012577c16ae90be1fab81b231ff3961
MD5 4be7b98182ca03bd59b1ee8235dc0060
BLAKE2b-256 df7635fe10479749b39e5b9ae03692baaa92cbb91c2db19b59247dd4b47d69d6

See more details on using hashes here.

File details

Details for the file aiowebostv-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: aiowebostv-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for aiowebostv-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5924191aa9a1630070b7f77e24949bc726dcf34d79c690330d06dfac07535586
MD5 c7e876319b5a12ab7e9cd8622daf429d
BLAKE2b-256 ee9147e2783439948210a24e4c50cc1d663980b6ac739c44783498a7cd598a9f

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