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.8

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.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

aiowebostv-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiowebostv-0.1.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for aiowebostv-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8615edd72eb80c868c4d9091c638b828a925267034093670ea4f93d7394ce352
MD5 65bb1e339bc2553e2e2191f33d4a4dbd
BLAKE2b-256 ddd4c42a7361a35239d2345ba2c79a958b546eff2490d22a529c6426db8e8364

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiowebostv-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for aiowebostv-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d710266b16b5958d485c6895cb2e6848c2f3b83d60c0ceb683eb4414d62e9f5a
MD5 941e3b60033fd1e9295fc3702e11ccd7
BLAKE2b-256 d576bc3e5eaa2c19bb89bc3a1f30cacada98bf3445932ad8fd8fd7aa41106197

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