Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just upgrade your @latest and failed install #90

Closed
adavison007 opened this issue Jul 24, 2019 · 50 comments
Closed

Just upgrade your @latest and failed install #90

adavison007 opened this issue Jul 24, 2019 · 50 comments

Comments

@adavison007
Copy link

Hi, I Just updated to @ latest version and I got the below message failed..... it also has removed the plugin Homebridge-zp completely as well as removing the Homebridge-lib plugin..... I can't install either now? had to also remove you from the JSOn file for home bridge to load.

Please help?

Screenshot 2019-07-24 at 23 53 33

@ebaauw
Copy link
Owner

ebaauw commented Jul 24, 2019

I cannot see the error message, but it looks like it’s failing to install the command-line utilities from homebridge-lib (which is now installed with homebridge-zp). The installation expects homebridge-lib in the node_modules under homebridge-zp, but apparently it’s installed next to it.

I’m not quite sure why this happens, let alone how to fix it. I think it is related to how you installed NodeJS or maybe to the platform you’re running on.

@ebaauw
Copy link
Owner

ebaauw commented Jul 24, 2019

I though I’d seen something similar before: ebaauw/homebridge-hue#421

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

Could you try again. I made some changes to v1.0.2 which might resolve this.

@adavison007
Copy link
Author

@ebaauw Thanks for the info... so I just tried again and now joy... So some further information for you.

I am using Hoobs on a RPI, I had installed your plugin HB-ZP and HB-LIB and all working fine for a few months, then yesterday I had updates showing for both -ZP and -LIB, I updated both, LIB first (fine) then ZP, after ZP, home bridge stopped working and I could not see the LIB or ZP plugins in the UI anymore....

Today I just separately removed both plugins from the CLI and tried the new update you suggested, no joy, see screen shot.. let me know if you can help, was working perfectly, something changed in your update for my system

Screenshot 2019-07-25 at 09 12 20

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

Can you remove homebridge-lib and then install only homebridge-zp?

@adavison007
Copy link
Author

Can you remove homebridge-lib and then install only homebridge-zp?

@ebaauw Just did that and exact same error

I tried a different plug in and that worked fine

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

I really don't understand how npm is configured on your system.

  • Where is it installing homebridge-lib (now again as regular dependency of homebridge-zp)? I would expect in /usr/local/lib/node_modules/homebridge-zp/node_modules/homebridge-lib.
  • Where does it place the symlinks for the homebridge-lib binaries? I would expect in /usr/local/lib/node_modules/homebridge-zp/node_modules/.bin, but obviously not, as chmod gives an ENOENT (no such file or directory).

Can you attach the debug log file created by npm? Please attach - don't list its contents, it's way too long.

@adavison007
Copy link
Author

@ebaauw I have ssh's into HOOBS but when trying to get to root for the log file I get permission denied, trying to contact hoops to work out how to get it...

Are you aware of hoobs? https://hoobs.org

What is weird is everything worked until the last update

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

Are you aware of hoobs?

Not really. I like to be in control myself of my installations.

What is weird is everything worked until the last update

I do understand that part: In that update, I re-added the commands from homebridge-lib to the bin section of the package.json of homebridge-zp. What I don't understand is why it doesn't install on HOOBS. Might even be an issue with the setup of the container (I think they're using Docker, but their website is extremely uninformative about their technical setup).

@adavison007
Copy link
Author

hoobs are really interactive and helpful if you connect to them on messenger via the website

@adavison007
Copy link
Author

@ebaauw OK, fixed it!!!! weird outcome though... so I deleted the LIB and ZP plugins via the cli in hoobs... I then installed the plugins in cli instead of the UI, first LIB, then ZP using SUDO first... now in the plugins in the UK i see ZP but not LIB.... all speakers back in and working in Homebridge... thanks for the help, but there is something weird about how this happened and why the LIB plugin does not show as a plugin...

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

OK, fixed it!!!!

Cool!

why the LIB plugin does not show as a plugin...

Because, since the latest release, homebridge-lib is no longer a Homebridge plugin - see the release notes, https://github.com/ebaauw/homebridge-lib/releases.

@hoefs
Copy link

hoefs commented Jul 25, 2019

pi@retropie:/usr/lib/node_modules$ sudo npm -g i homebridge-lib homebr
idge-zp
/usr/bin/hap -> /usr/lib/node_modules/homebridge-lib/cli/hap.js
/usr/bin/json -> /usr/lib/node_modules/homebridge-lib/cli/json.js
/usr/bin/upnp -> /usr/lib/node_modules/homebridge-lib/cli/upnp.js
/usr/bin/zpinfo -> /usr/lib/node_modules/homebridge-zp/cli/zp.js
npm ERR! path /usr/lib/node_modules/homebridge-zp/node_modules/.bin/ha
p
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/lib/nod
e_modules/homebridge-zp/node_modules/.bin/hap'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-25T17_48_53_137Z-debug.log
pi@retropie:/usr/lib/node_modules$

Not working after latest upgrade. Tried reinstalling. No luck...

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

The good (?) news, I managed to get the same error on an old Raspberry Pi 3B. The installation fails every time I try and install homebridge-lib and homebridge-zp in one go, and succeeds every time, I only install homebridge-zp.

And I didn't update the README to remove homebridge-lib form the installation instructions, now that's it's again a regular dependency :-(

I tested on the last few versions of npm - no difference.

$ sudo npm -g i homebridge-lib homebridge-zp
/usr/bin/hap -> /usr/lib/node_modules/homebridge-lib/cli/hap.js
/usr/bin/json -> /usr/lib/node_modules/homebridge-lib/cli/json.js
/usr/bin/upnp -> /usr/lib/node_modules/homebridge-lib/cli/upnp.js
/usr/bin/zpinfo -> /usr/lib/node_modules/homebridge-zp/cli/zp.js
npm ERR! path /usr/lib/node_modules/homebridge-zp/node_modules/.bin/hap
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/lib/node_modules/homebridge-zp/node_modules/.bin/hap'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-07-25T18_19_37_743Z-debug.log
$ sudo npm -g i homebridge-zp
/usr/bin/zpinfo -> /usr/lib/node_modules/homebridge-zp/cli/zp.js
/usr/bin/json -> /usr/lib/node_modules/homebridge-zp/node_modules/.bin/json
/usr/bin/upnp -> /usr/lib/node_modules/homebridge-zp/node_modules/.bin/upnp
/usr/bin/hap -> /usr/lib/node_modules/homebridge-zp/node_modules/.bin/hap
+ homebridge-zp@1.0.2
added 76 packages from 126 contributors in 22.037s

@adavison007
Copy link
Author

No nom update done, on 6.9.0

ebaauw added a commit that referenced this issue Jul 25, 2019
Revert listing the homebridge-lib command-line utilities in `bin`.  See #90, #91.
@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

Just published v1.0.3 and unpublished v1.0.1 an v1.0.2

@hoefs
Copy link

hoefs commented Jul 25, 2019

pi@retropie:/usr/lib/node_modules $ npm -version
6.10.2
pi@retropie:/usr/lib/node_modules $ sudo npm -g i homebridge-zp
/usr/bin/zpinfo -> /usr/lib/node_modules/homebridge-zp/cli/zp.js

  • homebridge-zp@1.0.3
    added 76 packages from 126 contributors in 11.73s

Still nothing in homekit...

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

Still nothing in homekit...

Might take a little while; HomeKit really doesn't seem to like configuration changes. Did you check the homebridge-log?

@hoefs
Copy link

hoefs commented Jul 25, 2019

removed everything and tried again

pi@retropie:/usr/lib/node_modules $ sudo npm -g i homebridge-zp
/usr/bin/zpinfo -> /usr/lib/node_modules/homebridge-zp/cli/zp.js

  • homebridge-zp@1.0.3
    added 76 packages from 126 contributors in 11.73s

during startup
pi@retropie:/usr/lib/node_modules $ sudo systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-07-25 21:03:27 CEST; 2s ago
Main PID: 3859 (homebridge)
Tasks: 7 (limit: 4915)
CGroup: /system.slice/homebridge.service
└─3859 homebridge

Jul 25 21:03:27 retropie systemd[1]: Started Node.js HomeKit Server.
Jul 25 21:03:29 retropie homebridge[3859]: [7/25/2019, 9:03:29 PM] Loaded config.json with 2 accessories and 4 platforms.
Jul 25 21:03:29 retropie homebridge[3859]: [7/25/2019, 9:03:29 PM] ---
Jul 25 21:03:29 retropie homebridge[3859]: [7/25/2019, 9:03:29 PM] Plugin /usr/lib/node_modules/homebridge-lib package.json does not contain the keyword 'homebridge-plugin'.

Still nothing in homekit

@hoefs
Copy link

hoefs commented Jul 25, 2019

Jul 25 21:03:32 retropie homebridge[3859]: [7/25/2019, 9:03:32 PM] [ZP] Initializing ZP platform...
Jul 25 21:03:32 retropie homebridge[3859]: [7/25/2019, 9:03:32 PM] [ZP] homebridge-zp v1.0.3, node 10.16.0, homebridge v0.4.50, homebridge-lib v4.3.3
Jul 25 21:03:32 retropie homebridge[3859]: [7/25/2019, 9:03:32 PM] [ZP] warning: config.json: ignoring "brightness" for "service": "undefined"
Jul 25 21:03:32 retropie homebridge[3859]: [7/25/2019, 9:03:32 PM] [Camera-ffmpeg] Initializing Camera-ffmpeg platform...
Jul 25 21:03:32 retropie homebridge[3859]: [7/25/2019, 9:03:32 PM] Loading 2 accessories...
Jul 25 21:03:32 retropie homebridge[3859]: [7/25/2019, 9:03:32 PM] [RaspberryPi CPU Temperature] Initializing RaspberryPiTemperature accessory...
Jul 25 21:03:32 retropie homebridge[3859]: [7/25/2019, 9:03:32 PM] [Occupancy Sensor] Initializing UniFi Occupancy Sensor accessory...
Jul 25 21:03:33 retropie homebridge[3859]: Load homebridge-lib.Lib
Jul 25 21:03:33 retropie homebridge[3859]: [7/25/2019, 9:03:33 PM] [homebridge-lib.Lib] homebridge-lib v4.3.3, node 10.16.0, homebridge v0.4.50, homebridge-lib v4.3.3
Jul 25 21:03:33 retropie homebridge[3859]: [7/25/2019, 9:03:33 PM] Woonkamer is running on port 42109.
Jul 25 21:03:33 retropie homebridge[3859]: [7/25/2019, 9:03:33 PM] Please add [Woonkamer] manually in Home app. Setup Code: 031-45-154
Jul 25 21:03:33 retropie homebridge[3859]: [7/25/2019, 9:03:33 PM] [ZP] listening on http://192.168.1.3:36865/notify
Jul 25 21:03:35 retropie homebridge[3859]: [7/25/2019, 9:03:35 PM] [ZP] found 3 zones
Jul 25 21:03:35 retropie homebridge[3859]: [7/25/2019, 9:03:35 PM] [ZP] error: TypeError: Cannot read property 'homeTheatre' of undefined
Jul 25 21:03:35 retropie homebridge[3859]:     at ZpPlatform.logTopology (/usr/lib/node_modules/homebridge-zp/lib/ZpPlatform.js:376:16)
Jul 25 21:03:35 retropie homebridge[3859]:     at ZpPlatform.parseZones (/usr/lib/node_modules/homebridge-zp/lib/ZpPlatform.js:331:12)
Jul 25 21:03:35 retropie homebridge[3859]:     at ZpPlatform.handleZonePlayerZoneGroupTopologyEvent (/usr/lib/node_modules/homebridge-zp/lib/ZpPlatform.js:363:12)
Jul 25 21:03:35 retropie homebridge[3859]:     at ZpClient.zpClient.on (/usr/lib/node_modules/homebridge-zp/lib/ZpPlatform.js:239:18)
Jul 25 21:03:35 retropie homebridge[3859]:     at ZpClient.emit (events.js:203:15)
Jul 25 21:03:35 retropie homebridge[3859]:     at IncomingMessage.request.on (/usr/lib/node_modules/homebridge-zp/lib/ZpListener.js:99:22)
Jul 25 21:03:35 retropie homebridge[3859]:     at process._tickCallback (internal/process/next_tick.js:68:7)
Jul 25 21:03:35 retropie homebridge[3859]: [7/25/2019, 9:03:35 PM] [homebridge-lib.Lib] warning: heartbeat 1, drift 345

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

Jul 25 21:03:35 retropie homebridge[3859]: [7/25/2019, 9:03:35 PM] [ZP] error: TypeError: Cannot read property 'homeTheatre' of undefined

Seen that one before: #88. Could you please list the output zp -H xx.xx.xx.xx topology -v, replacing the xx's with the IP address of one of you zone players?

@hoefs
Copy link

hoefs commented Jul 25, 2019

pi@retropie:/usr/lib/node_modules/homebridge-zp/cli $ ./zp.js -H 192.168.1.106 topology -v
{
  "BRIDGE": {
    "master": null,
    "name": "BRIDGE",
    "zonePlayers": {
      "BRIDGE": {
        "address": "192.168.1.102",
        "airPlay": false,
        "audioIn": false,
        "balance": false,
        "baseUrl": "http://192.168.1.102:1400",
        "bootSeq": 103,
        "channel": null,
        "homeTheatre": false,
        "id": "RINCON_B8E93714337001400",
        "lastSeen": 0,
        "modelName": "Sonos Bridge",
        "modelNumber": "ZB100",
        "name": "BRIDGE",
        "physicalControls": true,
        "role": "slave",
        "stereoPair": false,
        "tvIn": false,
        "version": "10.3",
        "zoneDisplayName": "BRIDGE",
        "zoneName": "BRIDGE"
      }
    }
  },
  "Bathroom": {
    "master": "Bathroom",
    "name": "Bathroom",
    "zonePlayers": {
      "Bathroom": {
        "address": "192.168.1.106",
        "airPlay": false,
        "audioIn": false,
        "balance": false,
        "baseUrl": "http://192.168.1.106:1400",
        "bootSeq": 31,
        "channel": null,
        "homeTheatre": false,
        "id": "RINCON_B8E937B15B9C01400",
        "lastSeen": 0,
        "modelName": "Sonos Play:1",
        "modelNumber": "S1",
        "name": "Bathroom",
        "physicalControls": true,
        "role": "master",
        "stereoPair": false,
        "tvIn": false,
        "version": "10.3",
        "zoneDisplayName": "Bathroom",
        "zoneName": "Bathroom"
      }
    }
  },
  "Living Room": {
    "master": "Living Room",
    "name": "Living Room",
    "zonePlayers": {
      "Living Room": {
        "address": "192.168.1.105",
        "airPlay": false,
        "audioIn": true,
        "balance": true,
        "baseUrl": "http://192.168.1.105:1400",
        "bootSeq": 119,
        "channel": null,
        "homeTheatre": false,
        "id": "RINCON_B8E93728A86801400",
        "lastSeen": 0,
        "modelName": "Sonos Play:5",
        "modelNumber": "S5",
        "name": "Living Room",
        "physicalControls": true,
        "role": "master",
        "stereoPair": false,
        "tvIn": false,
        "version": "10.3",
        "zoneDisplayName": "Living Room",
        "zoneName": "Living Room"
      }
    }
  }
}

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

Thanks, hadn't encountered a Bridge before. This is indeed the same issue as the Boost. Could you please run

$ zp -H 192.168.1.102 description -v > bridge.log

and attach (upload) bridge.log here? That will retrieve the SOAP calls supported by the Bridge from it. I don't suppose it has physical buttons, but does have a LED?

@hoefs
Copy link

hoefs commented Jul 25, 2019

description does not have -v parameter
bridge.log

This has always worked (for the last year) with the bridge in my setup.
The bridge is located in my garage. It has a led and a ?pairing? button. See attached pic
Screenshot 2019-07-25 at 21 50 17

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

This has always worked (for the last year) with the bridge in my setup.

v1.0.0 and later do more elaborate discovery of the Sonos topology, incl. slave and satellite players. In preparation to handle topology changes without having to restart Homebridge. Previous versions simply ignored invisible players.

description does not have -v parameter

Damn, I meant zp description -S.

@hoefs
Copy link

hoefs commented Jul 25, 2019

-S
bridge.log

ebaauw added a commit that referenced this issue Jul 25, 2019
- Support Sonos Bridge (similar to Sonos Boost), see #90.
@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

Should work with v1.0.4.

@hoefs
Copy link

hoefs commented Jul 25, 2019

It's working! Thanks

@fugazzy
Copy link

fugazzy commented Jul 25, 2019

For me the upgrade went fine, and it seems to work.
But I do get a lot of these only on a Sonos One: (Play:1 and Amp do not show this currently)
[ZP] Bad Sonos: error: POST /MediaRenderer/RenderingControl/Control: http status 500

@ebaauw
Copy link
Owner

ebaauw commented Jul 25, 2019

That's Sonos speak for: "no can do", e.g. trying to skip to next song when there is none. RenderingControl is used by the Speaker service for Volume, Mute, Balance, Bass, Treble, Loudness, Night Sound, and Speech Enhancement. Apparently homebridge-zp tries to do something to the Sonos One that it doesn't (currently?) support. What are you doing in HomeKit when these messages appear? What source is the One playing?

Could you please list the output of zpinfo -H xx.xx.xx.xx topology -v here. Replace the xx's by the IP address of the Sonos One.

Could you also please create a dump the SOAP calls supported by the Sonos One by running zpinfo -H xx.xx.xx.xx description -S > One.json and attach (upload) One.json?

@fugazzy
Copy link

fugazzy commented Jul 26, 2019

For me the upgrade went fine, and it seems to work.
But I do get a lot of these only on a Sonos One: (Play:1 and Amp do not show this currently)
[ZP] Bad Sonos: error: POST /MediaRenderer/RenderingControl/Control: http status 500

today I do not see these issues anymore on the One but on the Amp now - once: in conjunction with selecting a playlist from the favourites
[ZP] Wohnzimmer Amp TV: Active Identifier: Marillion Live
[ZP] Wohnzimmer Amp TV: error: POST /MediaRenderer/AVTransport/Control: http status 500
[ZP] Wohnzimmer Amp TV: Active Identifier: Marillion Live

Is Line-In on my Amp equal to TV in?
Switching to Sonos-Radio-Channels (tune in) in favourites works.
Switching to a playlist does not - the icon shows it, but it is not playing (stays on the radio channel)

something funny:
switching off and on again a Sonos-TV plays the last Text2Speech text the Sonos played (iobroker)

@ebaauw
Copy link
Owner

ebaauw commented Jul 26, 2019

[ZP] Wohnzimmer Amp TV: error: POST /MediaRenderer/AVTransport/Control: http status 500

That's is a different issue. homebridge-zp tries to play the favourite, but the Amp doesn't like it. Probably because there's something wrong with the encoding of the URI or the meta data. XML headaches...

What type of input is that favourite? Could you list the output of zpinfo -H ... browse FV:2.

Is Line-In on my Amp equal to TV in?

Audio In is the analogue input; TV in is the HDMI Arc input. Could you attach the output of zpinfo -H ... description -S of the Amp as well?

something funny:
switching off and on again a Sonos-TV plays the last Text2Speech text the Sonos played (iobroker)

I think the player remembers its most recent track. What track does the Sonos app display after the Text2Speech? What happens if you zp -H ... pause or zp -H ... stop and then zp -H ... play?

@fugazzy
Copy link

fugazzy commented Jul 27, 2019

is zp.js the same as zpinfo? (I do not find the last one)
/homebridge/node_modules/homebridge-zp/cli # ./zp.js -H 192.168.108.58 topology -v { "Bad": { "master": "Bad", "name": "Bad", "zonePlayers": { "Bad": { "address": "192.168.108.50", "airPlay": true, "audioIn": false, "balance": false, "baseUrl": "http://192.168.108.50:1400", "bootSeq": 13, "channel": null, "homeTheatre": false, "id": "RINCON_7828CA0F0D9601400", "lastSeen": 0, "modelName": "Sonos One", "modelNumber": "S13", "name": "Bad", "role": "master", "stereoPair": false, "tvIn": false, "version": "10.3", "zoneDisplayName": "Bad", "zoneName": "Bad" } } }, "Schlafzimmer": { "master": "Schlafzimmer", "name": "Schlafzimmer", "zonePlayers": { "Schlafzimmer": { "address": "192.168.108.35", "airPlay": false, "audioIn": false, "balance": false, "baseUrl": "http://192.168.108.35:1400", "bootSeq": 15, "channel": null, "homeTheatre": false, "id": "RINCON_949F3E07FD9601400", "lastSeen": 0, "modelName": "Sonos Play:1", "modelNumber": "S12", "name": "Schlafzimmer", "role": "master", "stereoPair": false, "tvIn": false, "version": "10.3", "zoneDisplayName": "Schlafzimmer", "zoneName": "Schlafzimmer" } } }, "Wohnzimmer Amp": { "master": "Wohnzimmer Amp", "name": "Wohnzimmer Amp", "zonePlayers": { "Wohnzimmer Amp": { "address": "192.168.108.58", "airPlay": true, "audioIn": true, "balance": true, "baseUrl": "http://192.168.108.58:1400", "bootSeq": 21, "channel": null, "homeTheatre": true, "id": "RINCON_347E5C02647201400", "lastSeen": 0, "modelName": "Sonos Amp", "modelNumber": "S16", "name": "Wohnzimmer Amp", "role": "master", "stereoPair": false, "tvIn": true, "version": "10.3", "zoneDisplayName": "Wohnzimmer Amp (+LS+RS)", "zoneName": "Wohnzimmer Amp" }, "Wohnzimmer Amp (LS)": { "address": "192.168.108.48", "airPlay": false, "audioIn": false, "balance": false, "baseUrl": "http://192.168.108.48:1400", "bootSeq": 51, "channel": "LS", "homeTheatre": true, "id": "RINCON_949F3E07FEEE01400", "lastSeen": 0, "modelName": "Sonos Play:1", "modelNumber": "S12", "name": "Wohnzimmer Amp (LS)", "role": "satellite", "stereoPair": false, "tvIn": false, "version": "10.3", "zoneDisplayName": "Wohnzimmer Amp (+LS+RS)", "zoneName": "Wohnzimmer Amp" }, "Wohnzimmer Amp (RS)": { "address": "192.168.108.41", "airPlay": false, "audioIn": false, "balance": false, "baseUrl": "http://192.168.108.41:1400", "bootSeq": 42, "channel": "RS", "homeTheatre": true, "id": "RINCON_949F3E04B75601400", "lastSeen": 0, "modelName": "Sonos Play:1", "modelNumber": "S12", "name": "Wohnzimmer Amp (RS)", "role": "satellite", "stereoPair": false, "tvIn": false, "version": "10.3", "zoneDisplayName": "Wohnzimmer Amp (+LS+RS)", "zoneName": "Wohnzimmer Amp" } } } }

@fugazzy
Copy link

fugazzy commented Jul 27, 2019

./zp.js -H 192.168.108.50 description -S > one.json and for the amp
Archiv.zip

@fugazzy
Copy link

fugazzy commented Jul 27, 2019

/homebridge/node_modules/homebridge-zp/cli # ./zp.js -H 192.168.108.58 browse FV:2
{
"1 LIVE": {
"description": "TuneIn Sender",
"play": "x-sonosapi-stream:s25260?sid=254&flags=8224&sn=0"
},
"Marillion Live": {
"description": "Apple Music Playliste",
"play": "x-rincon-cpcontainer:1006206clibraryplaylist%3ap.4YlevIZeNeq?sid=204&flags=8300&sn=1"
},
"Radio Bonn / Rhein-Sieg - Dein Karnevals Radio (Lokale Musik)": {
"description": "TuneIn Sender",
"play": "x-sonosapi-stream:s306798?sid=254&flags=8224&sn=0"
},
"Radio Köln 107.1 (Adult Contemporary)": {
"description": "TuneIn Sender",
"play": "x-sonosapi-stream:s16252?sid=254&flags=8224&sn=0"
},
"SWR3": {
"description": "TuneIn Sender",
"play": "x-sonosapi-stream:s24896?sid=254&flags=8224&sn=0"
},
"SWR3 Party": {
"description": "TuneIn Sender",
"play": "x-sonosapi-stream:s305017?sid=254&flags=8224&sn=0"
},
"SWR3 Rock": {
"description": "TuneIn Sender",
"play": "x-sonosapi-stream:s97033?sid=254&flags=8224&sn=0"
}
}

@fugazzy
Copy link

fugazzy commented Jul 27, 2019

when I turn on an ungrouped Sonos then it plays the last text2speech (shows the last played favourite ) and turns the Sonos off again. Its hard to select a different input, because with actual iOS you can only select an input when the "TV" is on.
zp -H ... play plays the same text2speech
zp -H ... pause gives:
zp pause: error: POST /MediaRenderer/AVTransport/Control: http status 500
zp -H ... stop does nothing noticeable (play afterwards stays the same)

I do experience quite often "keine Antwort" on the TV-icons (I think mostly on the group master)
(maybe a different issue, since i see that on a "harmony TV" also - or it just takes quite long to refresh)

@ebaauw
Copy link
Owner

ebaauw commented Jul 27, 2019

Thanks for the info!

is zp.js the same as zpinfo? (I do not find the last one)

Yes. The command is in/usr/lib/node_modules/homebridge-zp/cli/zp.js (depending where homebridge-zp was installed). npm -g should create a symlink using the old name: /usr/bin/zpinfo -> /usr/lib/node_modules/homebridge-zp/cli/zp.js. My bad; I'll change that to /usr/bin/zp. If you do a local install, npm places the symlink in a .bin directory. Not sure about windows. You should be able to start it using npx zp ... in case it's not in your path.

But I do get a lot of these only on a Sonos One: (Play:1 and Amp do not show this currently)
[ZP] Bad Sonos: error: POST /MediaRenderer/RenderingControl/Control: http status 500

I see no unexpected differences for the One, except for the VirtualLineIn service, which, I assume, is related to AirPlay. My newer Play:1 (S12) exposes that service, even though it doesn't support AirPlay, but my other players (PlayBar, Play:3, Play:1 (S1), Connect) don't.

Anyway, no changes to the RenderingControl service. I'll add some more debug messages, so homebridge-zp will log what command it sends to the zone player. I can only theorise the One was in some state, where it wouldn't accept any RenderingControl commands. Maybe because it was playing an AirPlay source? Or output volume level was fixed?

[ZP] Wohnzimmer Amp TV: Active Identifier: Marillion Live
[ZP] Wohnzimmer Amp TV: error: POST /MediaRenderer/AVTransport/Control: http status 500
[ZP] Wohnzimmer Amp TV: Active Identifier: Marillion Live
./zp.js -H 192.168.108.58 browse FV:2

A view peculiarities:

  • The "description" reads TuneIn Sender, but maybe that's just the German translation of TuneIn Station. The play URI looks like my TuneIn stations.
  • The "play" contains & instead of &. I don't know how this can be - homebridge-zp escapes its value and I haven't changed that part of the code since I introduced it. What version of zp are you on (zp -V)?
  • The "meta" is missing, and this seems to be required to play TuneIn. Looking at the code, this is because I look for "TuneIn Station" to create it. I actually don't check for this in the part of the code that creates the input source, so it shouldn't matter too much. Can you play the TuneIn stations from HomeKit?
  • I haven't setup Apple Music myself, but I do have configured my iTunes library. Those playlists don't seem to need meta, but the Apple Music URI looks more like the TuneIn that like the iTunes URI. Can you run
    DEBUG=ZpClient* zp -H ... browse FV:2 2>&1 > browse.log
    
    and upload browse log. That logs the XML sent by the zone player. No fun, but that might just be enough to understand how to play the Apple Music playlist. Otherwise we need to sniff the network and capture the command the Sonos app sends to the player.

when I turn on an ungrouped Sonos then it plays the last text2speech (shows the last played favourite ) and turns the Sonos off again.

What does Eve show as Track? Looks like homebridge-zp misses an event that the input gets switched to text2speech. What software do you use for that.

Its hard to select a different input, because with actual iOS you can only select an input when the "TV" is on.

Courtesy of Apple - nothing I can do about that. I'll add next/previous input to the Sonos accessory, so you can select it in Eve. Alternatively, use the Sonos app...

zp pause: error: POST /MediaRenderer/AVTransport/Control: http status 500

Another case of the speaker not currently accepting Pause. The speakers actually inform the app / their clients what transport actions it currently accepts, and homebridge-zp should only issue Play, Pause, Stop, Next Track, Previous Track when they're available.

I do experience quite often "keine Antwort" on the TV-icons (I think mostly on the group master)
(maybe a different issue, since i see that on a "harmony TV" also)

Most likely due to a hiccup in the communication between HomeKit and homebridge. Especially challenging when you have multiple Wifi access points. Turn off IGMP snooping on your router, switches, access points, or, if you have a Fritz!Box (that doens't support switching off IGMP snooping), make sure all access points are on the same port and don't use the Fritz WiFi. See homebridge/homebridge#1801.

@fugazzy
Copy link

fugazzy commented Jul 27, 2019

browse.log

/homebridge/node_modules/homebridge-zp/cli # ./zp.js -V
1.0.4

when I ungroup my sonos then I see on the non master sonos this track: sayit.0.tts.mp3 (that came from iobroker yesterday) in EVE ans SONOS-APP

currently I am not playing via AirPlay, it is only sonos and I do not have a fixed volume.

I do only use one fritzbox and no repeater and only one WiFi net (of course from the fritzbox)

I do have some hiccups from time to time but in this case it is only the TV-Icon mostly from the Amp in Home showing the issue.

I am running Homebridge in an docker image on a Synology

On my ethernet I use a Netgear Switch, that one had IGMP Snooping-Status set to ON. I now switched that off

@ebaauw
Copy link
Owner

ebaauw commented Jul 27, 2019

Hm it didn’t get the DEBUG=ZpClient* part, or it didn’t redirect stderr to the file (the 2>&1 part. Could you please double-check.

@fugazzy
Copy link

fugazzy commented Jul 27, 2019

Hmm, right, on the screen I do see such more information, but that does not geht into the file

DEBUG=ZpClient* /homebridge/node_modules/homebridge-zp/cli/zp.js -H 192.168.108.58 browse FV:2 2>&1 > browse.log

now I copied the text from the output:
browse.log

@ebaauw
Copy link
Owner

ebaauw commented Jul 27, 2019

Thanks. Looks like I'm sending the right data, but the zone player simply doesn't accept it.

I just realised I've got a trial Apple Music account I haven't really been using. Adding a single song as favourite works, but adding a playlist doesn't. Took out WireShark: the Sonos app doesn't play the playlist, but adds it to a queue, and then plays the queue. Doing some quick research online, it appears that this behaviour depends on the type of input source.

I'll open a new issue for this, so I can track it separately. I haven't done anything with Sonos queues yet, so I'm not sure how much of an effort it will be to support this.

Can you please confirm that you can play the radio stations?

@fugazzy
Copy link

fugazzy commented Jul 27, 2019

Thanks for your continuous work! I can confirm that the radio station do work.

@ebaauw
Copy link
Owner

ebaauw commented Jul 28, 2019

Just released v1.0.5, which should address most of what was mentioned above.

For further debugging the http status 500, please run homebridge -D to see what SOAP action homebridge-zp tried to send before the status, and take note of what the player's state was (playing or not, input, queue, member or coordinator of a group).

@fugazzy
Copy link

fugazzy commented Jul 28, 2019

Thanks very much! Generally it works and I can also play playlists from Apple Music.
But there seem to some issues under certain situations.
Sometimes switching from OFF to TV mode or TV mode to OFF results in switching back to OFF or TV mode. It is the same with AiPlay/AudioIn/Radio Channels
Switching ON/OFF from/to an Apple Musik playlist seems to work fine.

The Amp shows "keine Antwort" constantly on my iPAD and Mac but works fine on the iPhone (tested also with force quitting the Home App)
(no other issues with HomeKit at the moment, switching Off ICMP on the switch seems to have helped)
maybe this is related to that:
[ZP] Wohnzimmer Amp TV: warning: set Active Identifier: timed out

@ebaauw
Copy link
Owner

ebaauw commented Jul 28, 2019

Sometimes switching from OFF to TV mode or TV mode to OFF results in switching back to OFF or TV mode.

The zone player doesn't do play/pause when input is on TV (cf. the Sonos app that doesn't show the controls). I cannot hide characteristics dynamically in HomeKit, so, when on TV input, homebridge-zp shows the player as On when there's actually an input signal from the TV and Off otherwise.

It is the same with AiPlay/AudioIn/Radio Channels

The zone player issues multiple event notifications when switching inputs (stopped, connecting..., buffering..., playing). This causes homebridge-zp to display Off and then On again. Same happens on the Sonos app, where the Play/Stop button switches from Stop (indicating playing) to Play (indicating stopped) to Stop (indicating playing).

The Amp shows "keine Antwort" constantly on my iPAD and Mac but works fine on the iPhone

I take it, this is the TV accessory for the Amp? The Sonos accessory should show as reachable when the other bridged accessories are reachable as well.

This issue is unrelated to homebridge or any homebridge plugin. In my experience mostly when the iDevice can't find the accessory (HAP server) over Bonjour (that's where the IGMP snooping interferes). Usually fixed by switching the Wifi on your iDevice off and back on. If not, you might try to to remove the accessory from HomeKit and pair it again.

maybe this is related to that:
[ZP] Wohnzimmer Amp TV: warning: set Active Identifier: timed out

No. While waiting for a response from the zone player, homebridge-zp times out, returning the previous state to HomeKit. Thus making sure homebridge-zp will not cause HomeKit to perceive unresponsive accessories, even when the zone players are. This timeout is currently hard-coded to 1s. I still need to make this configurable thru config.json.

@fugazzy
Copy link

fugazzy commented Jul 28, 2019

Hmm, I am not sure if I understand you right?
Is it not possible to select the input on eg. the Amp and then the content to play?
I would like to use a scene to play radio (pre selected channel in TV accessory), another to watch TV, another to watch Apple TV, another to hear music via Sonos (selection in sonos App) and one to hear music via AirPlay (selection in Apple Music) and maybe one to directly select Sonos favourites. (selection in TV accessory)

The issue with the unresponsive Amp(-group) on the iPAD and Mac is only for one of my 3 sonos and not on my iPhone and only for the TV accessory.

Maybe it would be a good idea to pause playback the switching to a different channel?
Using scenes I could perhaps include a pause in the scene via Eve and the sonos/speaker accessory instead?

@ebaauw
Copy link
Owner

ebaauw commented Jul 29, 2019

Hmm, I am not sure if I understand you right?

Let me try an explain better (this is confusing, even to me). There's two unrelated issues:

  • When a zone player is on TV (digital audio) Input, it won't accept Play, Stop, nor Pause actions. It will just "play" whatever signal is on the digital input. In the Sonos app, the Play/Stop/Pause control is greyed out. I would like to do the same in HomeKit, but HomeKit doesn't support disabling or hiding a characteristic dynamically. So, instead, I map the On characteristic to whether the zone player is receiving a signal on the digital input.
    Note that you can still Play/Stop/Pause when the zone player is on (analogue) Audio Input. I don't know about AirPlay - maybe you can help me here: does the Sonos app show the Play/Stop/Pause button while the zone player's input is on AirPlay, or is the button greyed out?
  • When switching inputs (while playing), the zone player sends a series of AVTransport events to report stopped, connecting..., buffering..., playing. The Sonos app reflects this by changing the Play/Stop/Pause button a couple of times, homebridge-zp reflects this by flipping the On (or Active) characteristic a couple of times.

I would like to use a scene to play radio

In theory, you should be able to create a HomeKit scene to select an input and play it. However, it won't work currently, because:

  • Apple's Home app only supports the main characteristic of each service when editing scenes (so in case of the Television service, the Active characteristic);
  • HomeKit doesn't expose the Television accessory to other HomeKit apps.

So I would need to expose Current Identifier on the Sonos service as well, so you can use Eve to create the scene (after which it can be recalled from Home and Siri just fine). Now the challenge: Current Identifier is an integer field, corresponding to the Input Source service. Because HomeKit doesn't like configuration changes, I create a fixed number (currently 20) of these services, and only modify the Display Name, Current Visibility State and Is Configured characteristics when Sonos favourites or the grouping of zones are change. So you would have to use the number of the corresponding Input Source service:

  1. Join Coordinator, Leave Coordinator;
  2. AirPlay;
  3. Audio In;
  4. TV In;
  5. First Sonos favourite;
  6. Second Sonos favourite;
    ...
  7. 15th Sonos favourite;
  8. Sonos Chime.

I could probably renumber these to make it easer to remember (e.g. 101, ..., 115 for Sonos favourites). Or add the number to the Display Name, so it shows in the list. Of course, the number would still change if your add or remove a favourite (alphabetically before the one you include in the scene).

I don't think it's possible to include text characteristics in HomeKit scenes - none of the HomeKit apps I use (Eve, Matthias' Home, Hesperus) lets me include one. Even if it is, I wouldn't be able to validate whether you entered an existing input source.

ebaauw added a commit that referenced this issue Jul 29, 2019
See #90:
- Add _Active Identifer_ characteristic to Sonos service, so it can be included in HomeKit scenes.  The characteristic value mirrors the value of the TV service characteristic;
- After changing input source, wait for and ignore the _Stopped_ `AVTransport`event.  Only issue _Play_ after that.  This should fix the issue where a zone player would stop playing when switching input.  It should also stop _On_ from flipping during the change to the new input;
- Setup all 20 input as configured, so they're shown in the _Settings_ screen in Home, giving more insight into the input source numbering.  The _Input_ list still shows only the currently valid input sources.
- Allow valid input sources to be hidden from the _Input_ list.  Note that this resets when Sonos favourites are changed.
@fugazzy
Copy link

fugazzy commented Jul 29, 2019

Regarding AirPlay on my Sonos Amp I do see Play/Pause and Prev and Next and they are functional.
Maybe I still do not see the problems in detail.
I myself have no issues with play/pause being visible or not.
I would like to be able to freely choose the input on my Amp and select the content to play somewhere else (Sonos App, Apple Music App) or select a favourite (radio or playlist) or watch TV.

Actualy I use a combination of Home App and EVE to define my scenes. Everything I need I set up mostly via EVE (sonos and speaker settings) and I add the setting for the TV accessory via Home App.
TV accessory is not visible in EVE and the special settings are not visible in Home, but still they work nicely together.
I use that for my Sony television via homebridge-bravia-tvos. I switch between HDMI (Apple TV) and the TV channels (only selected I set up in the config )

Can I only switch eg. to TV input if there is a signal on that input?
I would expect that when I turn on the TV accessory I could switch to any channel I want not matter if there is a signal or not.

I have e.g. the following situation:
Last input was a playlist from the favourites and the TV accessory is on, my Sony TV is Off.
I now switch input to TV on the TV accessory.
What I see is that the TV accessory switches off.
I switch it on again and quite fast it turns off again.
Only if I am fast enough in the open accessory I am able to switch to a different input or favourite.

What I do not understand is why the TV accessory switches off here?

The switch to TV input works fine, if the Sony TV is already on, but it should be no matter if is already on to turned on later, or what do I miss here?

@ebaauw
Copy link
Owner

ebaauw commented Jul 29, 2019

Can I only switch eg. to TV input if there is a signal on that input?

No, you can switch to TV input whenever you want.

What I do not understand is why the TV accessory switches off here?

Because there is no signal on the digital input.

ebaauw added a commit that referenced this issue Jul 30, 2019
Different handling of TV input, to accomodate TV service (which only allows input selection when actvie, see #90):
- Force _On_ and _Active_ when zone player is on TV input;
- _TV_ is on when zone player is on TV and there's a signal on the digital input;
- _TV_ switches off immediately when input is changed;
- _TV_ switches off with a 10s delay when there's no more signal on the digital input (to cope with BluRay player or Netflix sending no signal when switching audio from stereo to Dolby Surround).
ebaauw added a commit that referenced this issue Jul 30, 2019
- When on TV input, report Sonos service as _On_ and TV service as _Active_; irrespective of the input signal, see #90.
- Skip manually hidden input sources when cycling through them in Sonos service or in Remote widged;
- Support sleep timer through _Set Duration_ and _Remaining Duration_ characteristics in Sonos service, see #95.
- Fix bug where homebridge-zp would no longer process AVTransport events after joining a group.
- Persist `currentTransportActions`.
@ebaauw
Copy link
Owner

ebaauw commented Jul 30, 2019

v1.0.7 sets On (on the Sonos service) and Active (on the TV service) when on TV input, regardless of the signal.

I think the only remaining situation where you cannot switch on a zone, is when there's no input source (so Play doesn't apply). I could try and force-switch the input to the Sonos Chime in this case, but I think it's better to use Remote widget or the Sonos service to cycle to another input.

@ebaauw ebaauw closed this as completed Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants