unfoldedcircle / feature-and-bug-tracker

Feature and bug tracker repository for Unfolded Circle products
24 stars 0 forks source link

[bug] Sonos integration setup doesn't enumerate all devices #107

Open mattgruter opened 11 months ago

mattgruter commented 11 months ago

Is there an existing issue for this?

Description

Upon adding the Sonos integration not all of my Sonos S2 devices are enumerated. I've run the setup process multiple times and I get different combination of devices listed (sometimes none are discovered, sometimes only one, sometimes more).

The log file mentions that the timeout of 5000ms is exceeded. All Sonos devices are on a wired network and since other integrations towards Sonos work without issues, I suspect this isn't an issue on the Sonos side or my home network.

How to Reproduce

  1. Go to integrations and add Sonos
  2. Wait for the device discovery to finish

Expected behavior

All of my Sonos S2 devices on the local network show up.

System version

v1.3.3

What part of the system affected by the problem?

Integration

Additional context

I have 2 RemoteTwos, both show the same behaviour.

Log excerpt from an unsuccessful discovery (IP addresses and device IDs have been redacted):

2023-10-06 09:52:59.369237 +00:00   intg-sonos  INFO    [Sonos Controller] Starting discovery.
2023-10-06 09:52:59.369237 +00:00   intg-sonos  INFO    [uc_sonos] Discovering devices on the network
2023-10-06 09:52:59.367564 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"event","msg":"driver_setup_change","msg_data":{"event_type":"SETUP","state":"SETUP"},"cat":"DEVICE"}
2023-10-06 09:52:59.362862 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"event","msg":"driver_setup_change","msg_data":{"event_type":"SETUP","state":"SETUP"},"cat":"DEVICE"}
2023-10-06 09:52:59.359862 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"resp","req_id":4,"code":200,"msg":"result","msg_data":{}}
2023-10-06 09:52:59.359862 +00:00   intg-sonos  INFO    [uc_sonos] Received user confirmation for driver setup: sending OK
2023-10-06 09:52:59.354195 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] -> {"kind":"req","id":4,"msg":"set_driver_user_data","msg_data":{"confirm":true}}
2023-10-06 09:52:38.825430 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"event","msg":"driver_setup_change","msg_data":{"event_type":"SETUP","state":"WAIT_USER_ACTION","require_user_action":{"confirmation":{"title":{"en":"No Sonos devices found"},"message1":{"en":"Please make sure that your Sonos devices are powered on and accessible from the same network as the remote. Click Next to try again."},"message2":null}}},"cat":"DEVICE"}
2023-10-06 09:52:38.825430 +00:00   intg-sonos  INFO    [uc_sonos] Could not discover any device
2023-10-06 09:52:38.820916 +00:00   intg-sonos  INFO    [Sonos Controller] Discovery finished.
2023-10-06 09:52:29.163885 +00:00   intg-sonos  INFO    [Sonos Controller] Device info is empty, this result won't be shown.
2023-10-06 09:52:29.162821 +00:00   intg-sonos  INFO    [Sonos Controller] Error getting info: https://192.168.1.xxx:1443/api/v1/players/RINCON_aaa/info timeout of 5000ms exceeded
2023-10-06 09:52:29.145588 +00:00   intg-sonos  INFO    [Sonos Controller] Device info is empty, this result won't be shown.
2023-10-06 09:52:29.140159 +00:00   intg-sonos  INFO    [Sonos Controller] Error getting info: https://192.168.1.yyy:1443/api/v1/players/RINCON_bbb/info timeout of 5000ms exceeded
2023-10-06 09:52:24.117789 +00:00   intg-sonos  INFO    [Sonos Controller] Getting device info: 192.168.1.yyy
2023-10-06 09:52:24.021803 +00:00   intg-sonos  INFO    [Sonos Controller] Getting device info: 192.168.1.xxx
2023-10-06 09:52:23.813607 +00:00   intg-sonos  INFO    [Sonos Controller] Starting discovery.
2023-10-06 09:52:23.812239 +00:00   intg-sonos  INFO    [uc_sonos] Discovering devices on the network
2023-10-06 09:52:23.810816 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"event","msg":"driver_setup_change","msg_data":{"event_type":"SETUP","state":"SETUP"},"cat":"DEVICE"}
2023-10-06 09:52:23.807013 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"event","msg":"driver_setup_change","msg_data":{"event_type":"SETUP","state":"SETUP"},"cat":"DEVICE"}
2023-10-06 09:52:23.805590 +00:00   intg-sonos  INFO    [uc_sonos] Acknowledged driver setup
2023-10-06 09:52:23.802374 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"resp","req_id":3,"code":200,"msg":"result","msg_data":{}}
2023-10-06 09:52:23.801485 +00:00   intg-sonos  INFO    [uc_sonos] Config saved to file.
2023-10-06 09:52:23.796442 +00:00   intg-sonos  INFO    [uc_sonos] Setting up driver. Setup data: [object Object]
2023-10-06 09:52:23.795023 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] -> {"kind":"req","id":3,"msg":"setup_driver","msg_data":{"setup_data":{}}}
2023-10-06 09:52:23.791555 +00:00   intg-sonos  INFO    [UC Integration API] <<- {"kind":"event","msg":"device_state","msg_data":{"state":"CONNECTED"},"cat":"DEVICE"}
2023-10-06 09:52:23.788574 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] -> {"id":2,"kind":"event","msg":"connect"}
2023-10-06 09:52:23.783244 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"resp","req_id":1,"code":200,"msg":"driver_version","msg_data":{"name":"Sonos","version":{"api":"0.20.0","driver":"0.3.13"}}}
2023-10-06 09:52:23.781993 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] -> {"id":1,"kind":"req","msg":"get_driver_version"}
2023-10-06 09:52:23.764971 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] <- {"kind":"resp","req_id":0,"code":200,"msg":"authentication","msg_data":{}}
2023-10-06 09:52:23.762431 +00:00   intg-sonos  INFO    [UC Integration API] [127.0.0.1:54856] WS: New connection
2023-10-06 09:46:35.546721 +00:00   intg-sonos  INFO    [UC Integration API] Driver info loaded
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO    }
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO      path: '/var/uc/integrations/sonos/config/sonos_config.json'
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO      code: 'ENOENT',
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO      syscall: 'open',
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO      errno: -2,
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at Function.Module._load (node:internal/modules/cjs/loader:868:12)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at Module.load (node:internal/modules/cjs/loader:1033:32)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at Module._compile (node:internal/modules/cjs/loader:1155:14)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at Object.<anonymous> (/opt/uc/integrations/sonos/driver.js:523:1)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at start (/opt/uc/integrations/sonos/driver.js:519:8)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at loadConfig (/opt/uc/integrations/sonos/driver.js:461:18)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at Object.readFileSync (node:fs:458:35)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO        at Object.openSync (node:fs:590:3)
2023-10-06 09:46:35.487565 +00:00   intg-sonos  INFO    [uc_sonos] No config file found. Starting with empty config. Error: ENOENT: no such file or directory, open '/var/uc/integrations/sonos/config/sonos_config.json'
zehnm commented 10 months ago

Are these 4 individual Sonos speakers, or 2 stereo pairs? Grouped together speakers are not shown as individual devices.

mattgruter commented 10 months ago

It's 4 individual devices (2 Sonos Amps, 1 Port, 1 IKEA speaker). None of them are grouped.

ahrens26 commented 8 months ago

Same issue - only a fraction of my devices are discovered.

loekf commented 5 months ago

I have a similar issue, none of my devices are discovered usually and maybe 2 out of 3 after hitting next again and again and restarting Sonos decices.

Sonos via HA works as a charm.