Skip to content

Commit

Permalink
Update ZpClient.js
Browse files Browse the repository at this point in the history
Handle mDNS advertisements for `_sonos._tcp.`, see #209.
  • Loading branch information
ebaauw committed Dec 11, 2023
1 parent 8c3af1b commit 4760baf
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/ZpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1135,26 +1135,28 @@ class ZpClient extends homebridgeLib.HttpClient {
this._reSubscribing = false
}

/** Handle an UPnP message.
/** Handle an mDNS or UPnP message that a zone player is alive.
*
* - Update {@link ZpClient#lastSeen lastSeen}.
* - Update {@link ZpClient#address address} when the zone player's IP
* address has changed.
* - Call {@link ZpClient#init init()} when {@link ZpClient#bootSeq bootSeq}
* has changed.
* @param {string} address - The IP address from which the UPnP message
* was received.
* @param {object} message - The parsed UPnP message.
*/
async handleUpnpMessage (address, message) {
if (this._props.id != null && message.usn.split(':')[1] !== this._props.id) {
* @param {object} message - The message.
* @param {string} message.id - The zone player ID.
* @param {string} message.address - The zone player IP address.
* @param {string} message.household - The zone player household.
* @param {interget} message.bootseq - The zone player boot sequence.
*/
async handleAliveMessage (message) {
if (this._props.id != null && message.id !== this._props.id) {
return
}
if (this._props.household !== message['x-rincon-household']) {
this._props.household = message['x-rincon-household']
if (this._props.household !== message.household) {
this._props.household = message.household
}
this._checkAddress(address)
await this._checkBootSeq(parseInt(message['x-rincon-bootseq']))
this._checkAddress(message.address)
await this._checkBootSeq(message.bootseq)
await this._updateLastSeen()
}

Expand Down

0 comments on commit 4760baf

Please sign in to comment.