Sonos Speakers Disconnecting after 30 minutes

Hi,

Currently have a problem where sonos speakers are disconnecting after 30 minutes (openHAB 3.4.1 - Release Build)

Have seen "HELP! My UPnP device isn't working right!" and other short stories and have updated the threading etc and my config now shows:

openhab> log:tail org.jupnp.OSGiUpnpServiceConfiguration
14:44:25.729 [INFO ] [rg.jupnp.OSGiUpnpServiceConfiguration] - OSGiUpnpServiceConfiguration createConfiguration threadPoolSize = -1 false
14:44:25.779 [INFO ] [rg.jupnp.OSGiUpnpServiceConfiguration] - OSGiUpnpServiceConfiguration createConfiguration asyncThreadPoolSize = -1 false
14:44:25.787 [INFO ] [rg.jupnp.OSGiUpnpServiceConfiguration] - OSGiUpnpServiceConfiguration retryAfterSeconds = 5
14:44:25.797 [INFO ] [rg.jupnp.OSGiUpnpServiceConfiguration] - OSGiUpnpServiceConfiguration retryIterations = 5000
14:44:25.805 [INFO ] [rg.jupnp.OSGiUpnpServiceConfiguration] - OSGiUpnpServiceConfiguration timeoutSeconds = 60

In my setup the sonos devices and open hab are in different vlans (with a unifi usg pro 4).
I’ve got igmp proxy, the TTL to 4, firewall rules etc - and its working fine on the sonos mobile controller between subnets, and also in openhab for 30 minutes.

Openhab starts up (its in a docker, but attached to the host network), sonos devices available for 30 minutes - i.e. i dont have to click discover at first boot. And then after almost exactly 30 minutes they change to showing as offline.

46:25.503 [INFO ] [openhab.event.ThingStatusInfoEvent   ] - Thing 'sonos:PLAY3:RINCON_5CAAFD592DD401400' updated: OFFLINE (COMMUNICATION_ERROR)
12:46:25.511 [INFO ] [openhab.event.ThingStatusInfoEvent   ] - Thing 'sonos:CONNECT:RINCON_949F3EBA334201400' updated: OFFLINE (COMMUNICATION_ERROR)
12:46:25.517 [INFO ] [openhab.event.ThingStatusInfoEvent   ] - Thing 'sonos:PLAY3:RINCON_B8E937D6CDB001400' updated: OFFLINE (COMMUNICATION_ERROR)
12:46:25.524 [INFO ] [openhab.event.ThingStatusInfoEvent   ] - Thing 'sonos:PLAY5:RINCON_949F3E53E74C01400' updated: OFFLINE (COMMUNICATION_ERROR)
12:46:26.596 [INFO ] [openhab.event.ThingStatusInfoEvent   ] - Thing 'sonos:PLAY5:RINCON_949F3E53E74C01400' updated: OFFLINE (COMMUNICATION_ERROR): The UPnP device RINCON_949F3E53E74C01400 is not yet registered.

Then going to add device, click sonos and then scan, and they are all immdiately back online:

12:48:41.899 [INFO ] [os.internal.handler.ZonePlayerHandler] - UPnP device RINCON_949F3EBA334201400 is present (thing sonos:CONNECT:RINCON_949F3EBA334201400)
12:48:41.922 [DEBUG] [os.internal.handler.ZonePlayerHandler] - Polling job
12:48:41.915 [DEBUG] [covery.ZonePlayerDiscoveryParticipant] - Discovered a Sonos 'sonos:PLAY5' thing with UDN 'RINCON_949F3E53E74C01400'
12:48:41.911 [INFO ] [os.internal.handler.ZonePlayerHandler] - UPnP device RINCON_949F3E53E74C01400 is present (thing sonos:PLAY5:RINCON_949F3E53E74C01400)
12:48:41.932 [DEBUG] [os.internal.handler.ZonePlayerHandler] - Polling job
12:48:41.941 [DEBUG] [covery.ZonePlayerDiscoveryParticipant] - Created a DiscoveryResult for device '10.3.1.124 - Sonos Connect' with UDN 'RINCON_949F3EBA334201400'
12:48:41.953 [DEBUG] [covery.ZonePlayerDiscoveryParticipant] - Created a DiscoveryResult for device '10.3.1.17 - Sonos Play:5' with UDN 'RINCON_949F3E53E74C01400'
12:48:41.952 [DEBUG] [os.internal.handler.ZonePlayerHandler] - RINCON_949F3EBA334201400: Subscribing to service DeviceProperties...
12:48:41.986 [DEBUG] [os.internal.handler.ZonePlayerHandler] - RINCON_949F3E53E74C01400: Subscribing to service DeviceProperties...

On the USG router I’ve got logging for any blocked intervlan or to fw packets - and not seeing anything flagged there.

Have also seen Sonos speakers disonnecting - #2 by JustinG but no updates for a solution.

Cheers, Ross

Try to directly configure them as Things and not rely on upnp auto discovery. They can be flaky, that helps. Also, make sure the sonos speakers arent changing IP addresses. Ive had that issue too in the past with them.

Hi - just tried manually creating one of them. I left it for a few minutes showing as offline - but then as soon as I clicked scan - it changed to online.

They all have fixed IP assigned to them in the unifi DHCP server settings.

There is an LG tv in the same subnet as the sonos devices. It got discovered automatically, and doesn’t go to offline.

I’ve just tried clicking scan in the generic upnpcontrol thing, and this also makes the sonos devices reappear as online.

I’ve currently put in place a work around with a cron rule that calls the below js script. Not pretty, but at least its keeping them online.

var HashMap = Java.type("java.util.HashMap");
var Base64 = Java.type("java.util.Base64");

var apiKey = "[API KEY]";
var hostUrl = "https://[HOSTANDPORT]";

var userAndPass = apiKey + ":" + "";
var userAndPassBase64 = Base64.getEncoder().encodeToString(userAndPass.getBytes("UTF-8"));
var authHeaderValue = "Basic " + userAndPassBase64;
var headers = new HashMap();
headers.put("Authorization", authHeaderValue);
var url = hostUrl + "/rest/discovery/bindings/sonos/scan"
var response = actions.HTTP.sendHttpPostRequest(url, "", "", headers, 10000);
console.log("Have called scan", response);

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.