Sonos控制API:轮询率和订阅 [英] Sonos control api: polling rate & subscription

查看:94
本文介绍了Sonos控制API:轮询率和订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在通过小型IOT设备控制超声波.该设备将放置在我们客户的家中.在我们的家庭自动化系统中,我们需要知道播放器状态/播放器/组的音量.我们可以问哪个轮询速率这些参数?

We are controlling the sonos via a small IOT device. This device will be placed at the homes of our customers. In our home automation system we need to know the playbackstate + volume of the players/groups. At which polling rate can we ask these parameters ?

我们无法使用云服务器来处理订阅事件.我试图将带有自签名证书的https webservice放在IOT设备中,但这不起作用.发布订阅后,我在Web服务中收到一个请求,但是Cloud Sonos服务器立即断开连接.可能是因为证书是自签名的-还是有其他原因?

We cannot use a cloud server to handle the subscription events. I tried to put a https webservice in the IOT device with a self signed certificate but this doesn't work. After I have posted the subscription I get a request in my webservice but the cloud sonos server disconnects immediately. Probably because of the certificate is self signed - Or can there be another reason ?

还有另一种方式来接收状态事件吗?发现期间在玩家Json对象中,有一个键"websocketUrl".该文档说该设备的安全WebSocket URL.请参阅连接以了解详细信息".但是我找不到关于此的更多信息.可以使用吗?

Is there another way to recieve status events ? During discovery In the players Json object there is a key 'websocketUrl'. The documentation says "The secure WebSocket URL for the device. See Connect for details". But I cannot find more info about this. Can this be used ?

推荐答案

您的问题未提供有关所用语言的详细信息,但是如果设备功能强大到可以运行节点,则使用<一个href ="https://svrooij.io/node-sonos-ts/" rel ="nofollow noreferrer">我的Sonos库.

Your question doesn't provide details about the language you're using, but if the device is powerfull enough to run node, you have a good change with my sonos library.

您可以随意从设备中提取所需的信息.或使用内置事件订阅.如果您使用这些事件,它将自动设置一个http侦听器并自动订阅您正在侦听的所有事件.

You can just pull the required information from the device as often as you like. Or use the build-in event subscriptions. If you use the events, it will automatically setup an http listener and automatically subscribe to all the events you're listening for.

事件是即时的(在设备发生事件后的50ms-100ms之内).

Events are instant (as in 50ms-100ms after the event took place on the device).

如果您请求信息,则将其直接发送到设备,并且设备将给出答案.每秒提取多个数据点对我来说从来都不是问题.

If you request information it is send directly to the device and the device will respond with the answer. Pulling multiple data points per second has never been a problem to me.

警告,如上所述,它使用了未记录的本地UPNP api,但是由于他们自己的应用程序也使用了该api,因此我猜这不会很快改变.

Warning as stated above, this uses the undocumented local UPNP api, but since their own app also uses it, I'm guessing that won't change soon.

这篇关于Sonos控制API:轮询率和订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆