使用PyChromecast从Chromecast Audio获取连接/断开连接状态

问题描述 投票:0回答:1

我正在尝试编写一个脚本来检测我的两个CC音频中的任何一个是否已断开连接,如果是,请执行其他操作。我尝试了一些不同的方法,例如ping设备。问题是,即使我无法通过Google Home连接它们,我也可以ping它们。

所以,我正在尝试使用PyChromecast。我在PyChromecast中尝试了一些不同的功能。最简单的应该是我在下面引用的那个。但是,我总是得到无,无论它是否连接。

def chromcastTest():
    castGarage = pychromecast.Chromecast("192.xxx.x.xx")
    print(castGarage.status)

输出:

没有

python chromecast
1个回答
0
投票

尝试使用以下区域获取chromecast:

chromecasts = pychromecast.get_chromecasts()
© www.soinside.com 2019 - 2024. All rights reserved.