juechafun/03-资源/执行脚本-工具技巧-USTONE清理红外指令.md

51 lines
975 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
#领域/工具技巧
#复盘/0
## 一句话描述
[____批量生成红外清理CMD指令____]
---
## 核心定义
以参数 `IP``ids` 程序输出指令复制所有行在CMD窗口右键粘贴
## 最小实现代码
```python
# ######## 参数设置 ########
IP = "192.168.1.180"
ids = []
ids.extend(range(3, 39))
# #########################
for id in ids:
    code = """curl -X POST http://""" + IP + """/v3 -d "{\\"ir"""
    code += str(id)
    code += '\\":0}"'
    print(code)
```
```bash
# 清理植物墙左侧红外开关门指令
# ir7 开门 ir8 关门
curl -X POST http://192.168.0.180/v3 -d "{\"ir7\":0}"
curl -X POST http://192.168.0.180/v3 -d "{\"ir8\":0}"
# 清理植物墙右侧红外开关门指令
# ir7 开门 ir8 关门
curl -X POST http://192.168.0.181/v3 -d "{\"ir7\":0}"
curl -X POST http://192.168.0.181/v3 -d "{\"ir8\":0}"
```
#状态/待实践
一些示例内容,例如样例程序可以给出基础的示例