svrooij / sonos2mqtt

:speaker: Sonos mqtt controller. Control your speakers from your mqtt server. mqtt-smarthome insprired.
https://sonos2mqtt.svrooij.io/
MIT License
76 stars 18 forks source link

Not all Sonos players are available in MQTT #175

Closed paulianttila closed 2 years ago

paulianttila commented 2 years ago

I have 3 Sonos players; Bean, One and Play:1. Bean is connected via Ethernet and two others are connected via SonosNet throw Bean.

Sonos speakers are in different VLAN than sonos2mqtt, so I have defined the Bean to be the "discovery" device (192.168.30.82).

Firewall settings:

Configuration:

SONOS2MQTT_DEVICE=192.168.30.82
SONOS2MQTT_MQTT=mqtt://192.168.10.20:1883
SONOS2MQTT_DISTINCT=true
SONOS_LISTENER_HOST=192.168.10.20
SONOS2MQTT_LOG=debug

sonos2mqtt find all 3 devices:

sonos2mqtt | 2022-05-22T10:05:38.399Z [Information] Starting sonos2mqtt v3.2.0
sonos2mqtt | 2022-05-22T10:05:38.407Z [Information] LogLevel changed to debug
sonos2mqtt | 2022-05-22T10:05:38.419Z [Information] Found 3 sonos speakers
sonos2mqtt | 2022-05-22T10:05:38.419Z [Debug] Setting up mqtt events
sonos2mqtt | 2022-05-22T10:05:38.450Z [Debug] Connected to server 192.168.10.20:1883
sonos2mqtt | 2022-05-22T10:05:38.450Z [Information] Mqtt connection changed to connected: true

http://192.168.10.20:6329/status contains all 3 devices (Device id's are masked!):

{
    "host": "192.168.10.20",
    "port": 6329,
    "isListening": true,
    "subscriptionUrl": "http://192.168.10.20:6329/sonos/{sonos-uuid}/{serviceName}",
    "listeningSince": "2022-05-22T09:10:39.527Z",
    "subscriptionCount": 7,
    "currentSubscriptions": [
      {
        "sid": "uuid:RINCON_9XXXXXXXXXX01400_sub0000000086",
        "uuid": "53425800-1f09-6188-44f8-5f7821608fa0",
        "host": "192.168.30.82",
        "service": "ZoneGroupTopology"
      },
      {
        "sid": "uuid:RINCON_9XXXXXXXXXX01400_sub0000000087",
        "uuid": "RINCON_9XXXXXXXXXX01400",
        "host": "192.168.30.82",
        "service": "AVTransport"
      },
      {
        "sid": "uuid:RINCON_9XXXXXXXXXX01400_sub0000000088",
        "uuid": "RINCON_9XXXXXXXXXX01400",
        "host": "192.168.30.82",
        "service": "RenderingControl"
      },
      {
        "sid": "uuid:RINCON_7XXXXXXXXXX01400_sub0000000075",
        "uuid": "RINCON_7XXXXXXXX01400",
        "host": "192.168.30.35",
        "service": "RenderingControl"
      },
      {
        "sid": "uuid:RINCON_7XXXXXXXXXX01400_sub0000000076",
        "uuid": "RINCON_7XXXXXXXXXX01400",
        "host": "192.168.30.35",
        "service": "AVTransport"
      },
      {
        "sid": "uuid:RINCON_BXXXXXXXXXX01400_sub0000000072",
        "uuid": "RINCON_BXXXXXXXXXX01400",
        "host": "192.168.30.22",
        "service": "AVTransport"
      },
      {
        "sid": "uuid:RINCON_BXXXXXXXXXX01400_sub0000000073",
        "uuid": "RINCON_BXXXXXXXXXX01400",
        "host": "192.168.30.22",
        "service": "RenderingControl"
      }
    ]
  }

In MQTT, discovery message is published to all 3 devices, but only 2 is available (Bean is missing):

image

svrooij commented 2 years ago

What does the console show if you send debug to sonos/cmd/setlogging? This will change logging to debug, that might show you what’s wrong.

And also set the environment variable DEBUG to sonos:*.

is the beam playing music or television?

paulianttila commented 2 years ago

And also set the environment variable DEBUG to sonos:*.

Thanks, by adding this, I saw that no subscription events was received from the Bean.

Root cause was my bad :pensive:. Bean IP address was changed in some point of time even IP addresses are fixed rather than dynamic. Firewall rule had still the old IP address, so it was blocking communication from Bean to 192.168.10.20:6329.