ebaauw / homebridge-zp

Homebridge plugin for Sonos ZonePlayer
Apache License 2.0
241 stars 20 forks source link

Can't join/group two Sonos speakers with command line : zp join #186

Closed pzim-devdata closed 2 years ago

pzim-devdata commented 2 years ago

Issue

Hello,

Thank you so much for your homebridge plugin.

I have a problem when I want to group my Sonos Roam and my Sonos One to play together. When I use this command line to join : zp -H 192.168.1.107 join RINCON_542A1B452AEC01400 I have the following error message :

    zp join: error: SyntaxError: initTopology() not yet called
    at ZpClient.checkInitTopology (/usr/local/lib/node_modules/homebridge-zp/lib/ZpClient.js:527:13)
    at ZpClient.get zones [as zones] (/usr/local/lib/node_modules/homebridge-zp/lib/ZpClient.js:944:10)
    at Main.join (/usr/local/lib/node_modules/homebridge-zp/cli/zp.js:1067:36)
    at Main.main (/usr/local/lib/node_modules/homebridge-zp/cli/zp.js:691:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Could you help me please ?

Log Messages

Here is the result of zp -H 192.168.1.107 topology :

zp topology: listening on http://0.0.0.0:42525/notify
{
  "RINCON_48A6B8F17EB401400": {
    "address": "192.168.1.107",
    "airPlay": true,
    "bootSeq": 2,
    "household": "Sonos_4E7jmaGsILCFp4B0pHewJ9Oowz",
    "id": "RINCON_48A6B8F17EB401400",
    "name": "Salle à manger",
    "role": "master",
    "zone": "RINCON_48A6B8F17EB401400",
    "zoneDisplayName": "Salle à manger",
    "zoneGroup": "RINCON_48A6B8F17EB401400",
    "zoneGroupName": "Salle à manger",
    "zoneGroupShortName": "Salle à manger",
    "zoneName": "Salle à manger"
  },
  "RINCON_542A1B452AEC01400": {
    "address": "192.168.1.128",
    "airPlay": true,
    "battery": {
      "rawPercentage": 98,
      "percentage": 100,
      "charging": true,
      "temperature": 24
    },
    "bootSeq": 82,
    "household": "Sonos_4E7jmaGsILCFp4B0pHewJ9Oowz",
    "id": "RINCON_542A1B452AEC01400",
    "name": "Salon",
    "role": "master",
    "zone": "RINCON_542A1B452AEC01400",
    "zoneDisplayName": "Salon",
    "zoneGroup": "RINCON_542A1B452AEC01400",
    "zoneGroupName": "Salon",
    "zoneGroupShortName": "Salon",
    "zoneName": "Salon"
  }
}

Debug Files

ebaauw commented 2 years ago

That smells like a bug in zp. I haven’t tried zo join for a long time, and messed with the initialisation order several times to address issues in Homebridge ZP. I need to do some testing this weekend to analyse what went wrong.

pzim-devdata commented 2 years ago

That smells like a bug in zp. I haven’t tried zo join for a long time, and messed with the initialisation order several times to address issues in Homebridge ZP. I need to do some testing this weekend to analyse what went wrong.

Thanks ;-)

ebaauw commented 2 years ago

That was simple, just call initTopology(). Also fixed some debug messages while at it.

ebaauw commented 2 years ago

In v1.4.9.

pzim-devdata commented 2 years ago

Thank you for your answer. It's working perfectly with the update to v1.4.9. The command line to join is : zp -H 192.168.1.128 join "Salle à manger" with the zoneGroupName or the zoneDisplayName at the end and not the zone. For instance zp -H 192.168.1.107 join RINCON_542A1B452AEC01400 dosesn't work.

Thank you ;-)

ebaauw commented 2 years ago

I don’t know the RINCON numbers of my zone players by heart, so It makes more sense to me to use the zone name, instead of the zone player ID. I did consider using the hostname or IP address (to be consistent with the -H flag), but that would be more complex technically and I never implemented that.

pzim-devdata commented 2 years ago

Yes you're right. It's perfect like this. I meant in zp help when we execute zp -h, the join line should be join [-h] zoneGroupName or join [-h] zoneDisplayName and not join [-h] zone Thank you for your help ;-)