Skip to content

Commit e68a906

Browse files
authored
Update README.md
润色MEAD.MD并修复了日志bug
1 parent 55e3e4e commit e68a906

File tree

1 file changed

+73
-51
lines changed

1 file changed

+73
-51
lines changed

README.md

Lines changed: 73 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,73 @@
1-
# 本包是为玩客云PiKVM打包的 python-miio-git 虚拟环境
2-
# 源项目地址 : https://github.com/rytilahti/python-miio
3-
4-
# 使用说明
5-
# 将本压缩包解压到 /opt 目录下
6-
sudo mkdir -p /opt/python-miio-git
7-
sudo tar -zcvf python-miio-git.tar.gz -C /opt/python-miio-git
8-
9-
# 修改 miplug.sh 填写智能插座的IP和TOKEN
10-
# 获取智能插座的IP和TOKEN请参考
11-
# https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor
12-
# 默认设备类型 : genericmiot
13-
# 设备类型详看 python-miio 官方文档
14-
# https://python-miio.readthedocs.io/en/latest/index.html#controlling-modern-miot-devices
15-
16-
# 复制 miplug.sh 到 /etc/kvmd/
17-
sudo cp miplug.sh /etc/kvmd/
18-
sudo chmod -x /etc/kvmd/miplug.sh
19-
20-
# 配置日志权限
21-
sudo touch /var/log/miplug.log
22-
sudo chown kvmd:kvmd /var/log/miplug.log
23-
sudo chmod 664 /var/log/miplug.log
24-
25-
# 备份 ovreeide.yaml
26-
sudo cp /etc/kvmd/ovreeide.yaml /etc/kvmd/ovreeide.yaml.backup
27-
28-
# 参考 override.yaml 修改 /etc/kvmd/override.yaml 添加对应参数
29-
30-
miplug_on: # 米家智能插座控制开
31-
type: cmd
32-
cmd: [/bin/bash, /etc/kvmd/miplug.sh, on]
33-
miplug_off: # 米家智能插座控制关
34-
type: cmd
35-
cmd: [/bin/bash, /etc/kvmd/miplug.sh, off]
36-
37-
start_power: # 上电
38-
driver: miplug_on
39-
pin: 0
40-
mode: output
41-
switch: false
42-
stop_power: # 断电
43-
driver: miplug_off
44-
pin: 0
45-
mode: output
46-
switch: false
47-
48-
- ["#智能插座:",start_power|开,stop_power|关] #UI
49-
50-
# 重启kvmd kvmd-nginx
51-
systemctl restart kvmd kvmd-nginx
1+
# 玩客云 PiKVM 的 Python-miio-git 虚拟环境
2+
3+
本包是为玩客云 PiKVM 打包的 `python-miio-git` 虚拟环境。
4+
5+
源项目地址: [python-miio](https://github.com/rytilahti/python-miio)
6+
7+
## 使用说明
8+
9+
1. **解压缩压缩包**
10+
将本压缩包解压到 `/opt` 目录下:
11+
```bash
12+
sudo mkdir -p /opt/python-miio-git
13+
sudo tar -zxvf python-miio-git.tar.gz -C /opt/python-miio-git
14+
15+
16+
2. **修改配置文件**
17+
修改 `miplug.sh` 文件,填写智能插座的 IP 和 TOKEN。获取智能插座的 IP 和 TOKEN 请参考 [Xiaomi-cloud-tokens-extractor](https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor)。
18+
19+
默认设备类型: `genericmiot`。设备类型详情请参见 `python-miio` 官方文档:[Controlling Modern MiOT Devices](https://python-miio.readthedocs.io/en/latest/index.html#controlling-modern-miot-devices)。
20+
3. **复制脚本文件**
21+
复制 `miplug.sh``/etc/kvmd/` 目录:
22+
```bash
23+
sudo cp miplug.sh /etc/kvmd/
24+
sudo chmod +x /etc/kvmd/miplug.sh
25+
26+
27+
28+
4. **配置日志权限**
29+
创建日志文件并修改权限:
30+
```bash
31+
sudo touch /var/log/miplug.log
32+
sudo chown kvmd:kvmd /var/log/miplug.log
33+
sudo chmod 664 /var/log/miplug.log
34+
35+
36+
37+
5. **备份配置文件**
38+
备份 `ovreeide.yaml` 文件:
39+
```bash
40+
sudo cp /etc/kvmd/ovreeide.yaml /etc/kvmd/ovreeide.yaml.backup
41+
42+
43+
44+
6. **修改 override.yaml**
45+
根据 `override.yaml` 的参考,修改 `/etc/kvmd/override.yaml` 文件,添加对应参数:
46+
47+
```yaml
48+
miplug_on: # 米家智能插座控制开
49+
type: cmd
50+
cmd: [/bin/bash, /etc/kvmd/miplug.sh, on]
51+
miplug_off: # 米家智能插座控制关
52+
type: cmd
53+
cmd: [/bin/bash, /etc/kvmd/miplug.sh, off]
54+
55+
start_power: # 上电
56+
driver: miplug_on
57+
pin: 0
58+
mode: output
59+
switch: false
60+
stop_power: # 断电
61+
driver: miplug_off
62+
pin: 0
63+
mode: output
64+
switch: false
65+
66+
- ["#智能插座:", start_power|开, stop_power|关] # UI
67+
68+
69+
70+
7. **重启服务**
71+
重启 `kvmd``kvmd-nginx` 服务:
72+
```bash
73+
systemctl restart kvmd kvmd-nginx

0 commit comments

Comments
 (0)