Library to control webOS based LG TV devices
Project description
aiowebostv
Python library to control LG webOS based TV devices.
Based on:
aiopylgtv
library at https://github.com/bendavid/aiopylgtvbscpylgtv
library at https://github.com/chros73/bscpylgtv
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
Release history Release notifications | RSS feed
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.3.1.tar.gz
(17.2 kB
view details)
Built Distribution
File details
Details for the file aiowebostv-0.3.1.tar.gz
.
File metadata
- Download URL: aiowebostv-0.3.1.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccf7098b53f6fa57a07490d878058df4373b2abcdcb7544582e3e7eb4d9d7c90 |
|
MD5 | 2662a2d312ba6b729f2a000c04520c71 |
|
BLAKE2b-256 | a501c097130e49f7f30c52e89dbeb15a6e2fbd4d2b412d282a55cac0353e7f84 |
File details
Details for the file aiowebostv-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: aiowebostv-0.3.1-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaa6eacdf0e8696a0909ea63b0826b3e17b0f4bd57605dcc7ea1e4b414a59e49 |
|
MD5 | 8e813601e6da57d53325facdad63b87b |
|
BLAKE2b-256 | 880745de1932ff8dfe450f29801f37377973040cf83bc86f43e52ea28074a4b6 |