用于控制基于 webOS 的 LG 电视设备的库
项目描述
aiowebpostv
用于控制基于 LG webOS 的电视设备的 Python 库。
基于:
aiopylgtvhttps://github.com/bendavid/aiopylgtv的图书馆bscpylgtvhttps://github.com/chros73/bscylgtv上的库
要求
- 蟒蛇> = 3.9
安装
pip install aiowebostv
从源安装
在此文件夹中运行以下命令
pip install --upgrade .
例子
基本示例:
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())
订阅状态更新示例:
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文件夹中找到
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
aiowebostv-0.2.0.tar.gz
(17.0 kB
查看哈希)
内置分布
aiowebostv-0.2.0-py3-none-any.whl
(16.7 kB
查看哈希)
关
aiowebostv -0.2.0.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | ae5a5c58295e3878e3797b7315c8fe875ccf7ba71bb40d0c767a08222af328cf |
|
| MD5 | 65bde2a8197e2004ac0e61c19b141cb7 |
|
| 布莱克2-256 | 867aa243f01e0c47a4bede5c2d7498d3cc7426efff4507db63483ad411f95b75 |
关
aiowebostv -0.2.0-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 10aca26f674c2b7ee77ea458364f2506bf024df68d1bec0014f64bcfffb5859b |
|
| MD5 | c0f6b5eea4123fddfde216e6ca94bb5c |
|
| 布莱克2-256 | f6e5f8b5bfb0f70c6e0a1f5d960594e59366178758f623371009506c6044e89f |