用于向ITach IP2ir网关发送ir命令的库
pyitachip2ir的Python项目详细描述
ITachip2ir库
一个带有Python绑定的C++库,用于将IR命令发送到ITACH IP2IR网关。
可以给它一个IP地址和端口来连接,也可以给它一个MAC地址,它将监听来自任何与MAC地址匹配的ITach网关的广播。
它从遵循以下格式的命令库文件中获取ir命令:
CH1 0000 006D 0000 0022 00AC 00AB 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0689 CH2 0000 006D 0000 0022 00AC 00AB 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0689
依赖关系
- CMake 2.8 or Python 2 or 3
如何使用
- Executable command line interface for sending one shot ir commands
./itachip2ir [ip-of-itach] [itach-listening-port] [ir-commands.txt] [name-of-ir-command] [itach-mod] [itach-conn] [message-count]
- Python object
importpyitachip2irimportlogginglogging.basicConfig(level=logging.INFO)# Get log messages from pyitachip2irmac_address=None# If known use this, it will search for the itachip_address="127.0.0.1"port=4998itach=pyitachip2ir.ITachIP2IR(mac_address,ip_address,port)withopen("tv_commands.txt",'r')ascmds:itach.addDevice("tv",1,3,cmds.read())ifnotitach.ready(5000):# Search for 5 seconds for deviceraiseIOError("ITach not found")itach.send("tv","ON",1)