google home&mini的简单cli
ghome的Python项目详细描述
ghome:google home&mini的简单cli
这是google home api蓝图的一个应用程序。虽然许多端点可能会引起很多人的兴趣,但我使用了我最常用的端点,我认为它们最有用,并创建了一个命令行工具,供您搜索Google Home Mini设备,然后使用此工具与之交互并根据需要执行操作。
目录
安装
这假设您的系统中安装了本机python&pip,您可以通过转到终端(或windows命令提示符)并尝试
python
然后pip list
如果没有错误,并且使用了Python2.7.14或更高版本,那么应该可以继续使用。请注意,我只在Python2.7.15上测试过它,但它应该在Python3上运行。
要安装ghome:simple cli for google home&;mini可以使用两种方法安装。
pip install ghome
或者您也可以尝试
git clone https://github.com/samapriya/ghome.git
cd ghome
python setup.py install
对于Linux,请使用sudo或尝试pip install ghome --user
。
安装是一个可选步骤;应用程序也可以通过执行ghome.py脚本直接运行。安装ghome的好处是它可以作为任何命令行工具执行。我建议在虚拟环境中安装。如果不想安装,请浏览到ghome文件夹并尝试python ghome.py
以获得相同的结果。
开始
如往常一样,要打印帮助:
usage: ghome [-h] {list,reboot,alarm,dnd,bstat,bscan,bpair,bdisc,wscan} ...
Simple Google Home Mini Client
positional arguments:
{list,reboot,alarm,dnd,bstat,bscan,bpair,bdisc,wscan}
list Lists all google home mini devices & IP address
reboot Reboot a google home mini using IP address
alarm Print out the current alarms setup on your google home
mini
dnd Enable or disable <Do not Disturb mode> for a google
home mini using IP address
bstat Print current bluetooth status for a google home mini
using IP address
bscan Scan for Bluetooth devices near a google home mini
using IP address
bpair Print current paired bluetooth devices for a google
home mini using IP address
bdisc Enable or disable bluetooth discovery for a google
home mini using IP address
wscan Scan for Wifi networks near a google home mini using
IP address
optional arguments:
-h, --help show this help message and exit
要获得特定功能的帮助,只需使用help开关调用它,例如:ghome wscan -h
。如果您没有安装ghome,那么只需转到ghome目录并运行python ghome.py [arguments go here]
ghome simple cli for earth engine上传
该工具基于curret为该设备发布的非官方api蓝图,将来可能会有所更改。
列表
**这是一个关键步骤,因为它列出了所有谷歌家庭迷你设备在您的wifi,它使用nmap来识别上述设备。您可以使用第三方工具(如[fing]来识别您的google家庭设备)来避免使用此工具。
ghome list
重新启动
只是一个简单的工具,重新启动你的谷歌家庭设备迅速。
usage: ghome reboot [-h] [--ip IP]
optional arguments:
-h, --help show this help message and exit
Required named arguments.:
--ip IP Use "ip" for Google Home Mini device
警报
此工具将简单列出当前设备上的所有警报,包括日期、时间和时区。
usage: ghome alarm [-h] [--ip IP]
optional arguments:
-h, --help show this help message and exit
Required named arguments.:
--ip IP Use "ip" for Google Home Mini device
请勿打扰
启用或禁用Google Home Mini上的“请勿打扰”模式。
usage: ghome dnd [-h] [--ip IP] [--action ACTION]
optional arguments:
-h, --help show this help message and exit
Required named arguments.:
--ip IP Use "ip" for Google Home Mini device
--action ACTION enable|disable do not disturb mode
蓝牙状态
蓝牙状态打印设备发现是否已启用、扫描是否已启用以及是否已连接到设备。
usage: ghome bstat [-h] [--ip IP]
optional arguments:
-h, --help show this help message and exit
Required named arguments.:
--ip IP Use "ip" for Google Home Mini device
蓝牙扫描
这将打印蓝牙状态,包括可能的蓝牙设备名称和Mac名称
usage: ghome bstat [-h] [--ip IP]
optional arguments:
-h, --help show this help message and exit
Required named arguments.:
--ip IP Use "ip" for Google Home Mini device
蓝牙配对
检查设备是否通过蓝牙与任何当前设备配对,以及所有已连接设备、上次连接设备的历史记录,以及它们当前是否已连接。
usage: ghome bpair [-h] [--ip IP]
optional arguments:
-h, --help show this help message and exit
Required named arguments.:
--ip IP Use "ip" for Google Home Mini device
蓝牙发现
这是为了根据需要启用或禁用蓝牙发现以允许配对。该操作可以与IP一起启用或禁用。
usage: ghome bdisc [-h] [--ip IP] [--action ACTION]
optional arguments:
-h, --help show this help message and exit
Required named arguments.:
--ip IP Use "ip" for Google Home Mini device
--action ACTION enable|disable bluetooth discovery
WiFi扫描
打印所有可用的WiFi连接的WiFi扫描结果和基于设备接近其他连接的SSID。您可能需要运行两次,因为它可能不会直接构建设备缓存。
usage: ghome wscan [-h] [--ip IP]
optional arguments:
-h, --help show this help message and exit
Required named arguments.:
--ip IP Use "ip" for Google Home Mini device