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

No status changes #159

Closed JonasMH closed 2 years ago

JonasMH commented 2 years ago

I have sonos2mqtt setup through docker/docker-compose, and as expected it connects and finds my three speakers (All are S2) and I'm able to control them. But i never get any status updates. I have found a few others tickets related (#148, #130, #104) - and ensured I have my configuration set as seem to be the main problem in those tickets.

docker-compose.yml:

  sonos2mqtt:
    image: svrooij/sonos2mqtt
    environment:
      - SONOS2MQTT_DEVICE=192.168.0.109
      - SONOS2MQTT_MQTT=mqtt://mosquitto
      - SONOS2MQTT_DISCOVERY=true
      - SONOS2MQTT_DISTINCT=true
      - SONOS2MQTT_LOG=debug
      - SONOS_LISTENER_HOST=192.168.0.40
      - SONOS_LISTENER_PORT=6329
    ports:
      - "6329:6329"

sonos2mqtt debug log:

2022-01-22T19:52:29.989Z [Information] Starting sonos2mqtt v3.1.2
2022-01-22T19:52:30.000Z [Information] LogLevel changed to debug
2022-01-22T19:52:30.034Z [Information] Found 3 sonos speakers
2022-01-22T19:52:30.034Z [Debug] Setting up mqtt events
2022-01-22T19:52:30.080Z [Debug] Connected to server mosquitto
2022-01-22T19:52:30.080Z [Information] Mqtt connection changed to connected: true

Published messages:

[2022-01-22T19:52:40.788+00:00 INF 11] sonos/connected: 2
[2022-01-22T19:52:40.789+00:00 INF 11] homeassistant/music_player/RINCON_7XXXX/sonos/config: {"available_commands":["adv-command","clearqueue","command","joingroup","leavegroup","mute","next","notify","notifytwo","pause","play","playmode","previous","queue","seek","selecttrack","setbass","setbuttonlockstate","setledstate","setnightmode","setavtransporturi","settreble","sleep","speak","speaktwo","stop","switchtoline","switchtoqueue","switchtotv","toggle","unmute","volume","volumedown","volumeup"],"command_topic":"sonos/RINCON_7XXXX/control","device":{"identifiers":["RINCON_7XXXX"],"manufacturer":"Sonos","name":"Bedroom"},"device_class":"speaker","icon":"mdi:speaker","json_attributes":true,"json_attributes_topic":"sonos/RINCON_7XXXX","name":"Bedroom","state_topic":"sonos/RINCON_7XXXX","unique_id":"sonos2mqN_347E5CF3XXXX","availability_topic":"sonos/connected","payload_available":"2"}
[2022-01-22T19:52:40.789+00:00 INF 11] homeassistant/music_player/RINCON_2XXXX/sonos/config: {"available_commands":["adv-command","clearqueue","command","joingroup","leavegroup","mute","next","notify","notifytwo","pause","play","playmode","previous","queue","seek","selecttrack","setbass","setbuttonlockstate","setledstate","setnightmode","setavtransporturi","settreble","sleep","speak","speaktwo","stop","switchtoline","switchtoqueue","switchtotv","toggle","unmute","volume","volumedown","volumeup"],"command_topic":"sonos/RINCON_2XXXX/control","device":{"identifiers":["RINCON_2XXXX"],"manufacturer":"Sonos","name":"Bathroom"},"device_class":"speaker","icon":"mdi:speaker","json_attributes":true,"json_attributes_topic":"sonos/RINCON_2XXXX","name":"Bathroom","state_topic":"sonos/RINCON_2XXXX","unique_id":"sonos2mqN_347E5CC6XXXX","availability_topic":"sonos/connected","payload_available":"2"}
[2022-01-22T19:52:40.789+00:00 INF 11] homeassistant/music_player/RINCON_9XXXX/sonos/config: {"available_commands":["adv-command","clearqueue","command","joingroup","leavegroup","mute","next","notify","notifytwo","pause","play","playmode","previous","queue","seek","selecttrack","setbass","setbuttonlockstate","setledstate","setnightmode","setavtransporturi","settreble","sleep","speak","speaktwo","stop","switchtoline","switchtoqueue","switchtotv","toggle","unmute","volume","volumedown","volumeup"],"command_topic":"sonos/RINCON_9XXXX/control","device":{"identifiers":["RINCON_9XXXX"],"manufacturer":"Sonos","name":"Living Room"},"device_class":"speaker","icon":"mdi:speaker","json_attributes":true,"json_attributes_topic":"sonos/RINCON_9XXXX","name":"Living Room","state_topic":"sonos/RINCON_9XXXX","unique_id":"sonos2mqN_000E58B8XXXX","availability_topic":"sonos/connected","payload_available":"2"}

Configurations I have tried so far: SONOS2MQTT_DISTINCT true / false SONOS2MQTT_DEVICE change between different speakers SONOS_LISTENER_HOST is set to my host machines IP (I have checked ipconfig a few times to make sure) SONOS_LISTENER_PORT 6329, and tried to change both the env. var and the docker port binding to another port to see if 6329 was in use on my machine and i got no error

I have the Sonos windows application running locally on my machine - and it seems to work fine. I also tried closing the Sonos app and triggering changes from my phone - still not status updates.

Any ideas?

svrooij commented 2 years ago

So if you’re sure this is correct SONOS_LISTENER_HOST=192.168.0.40 you should be able to access the status endpoint at http://192.168.0.40:6329/status

What is your environment looking like? OS? Docker? Firewall turned off or post 6329 added? It is going to be a port that will be called from the Sonos speakers.

JonasMH commented 2 years ago

Hi, and thanks for the quick response.

OS: Win11 21H2 Docker: 4.4.3 / Engine 20.10.12

Accessing http://192.168.0.40:6329/status locally from the machine results in the code below (now formatted):

And just tried to access http://192.168.0.40:6329/status from another machine and it didn't work until I made a firewall exception as you mentioned... Now I'm also getting updates 🤦‍♂️I had even tried the UPNP Device Spy where it worked, but I guess it made the firewall exception for me.

Thanks for helping 👍

{
  "host": "192.168.0.40",
  "port": 6329,
  "isListening": true,
  "subscriptionUrl": "http://192.168.0.40:6329/sonos/{sonos-uuid}/{serviceName}",
  "listeningSince": "2022-01-22T20:28:41.128Z",
  "subscriptionCount": 7,
  "currentSubscriptions": [
    {
      "sid": "uuid:RINCON_000Exxx_sub0000000380",
      "uuid": "54771a24-7693-b98d-7f8b-fb980d66de71",
      "host": "192.168.0.109",
      "service": "ZoneGroupTopology"
    },
    {
      "sid": "uuid:RINCON_34xxx01400_sub0000000614",
      "uuid": "RINCON_3xxx01400",
      "host": "192.168.0.106",
      "service": "AVTransport"
    },
    {
      "sid": "uuid:RINCON_3xxx01400_sub0000000523",
      "uuid": "RINCON_3xxx01400",
      "host": "192.168.0.105",
      "service": "AVTransport"
    },
    {
      "sid": "uuid:RINCON_3xxx01400_sub0000000615",
      "uuid": "RINCON_3xxx01400",
      "host": "192.168.0.106",
      "service": "RenderingControl"
    },
    {
      "sid": "uuid:RINCON_3xxx01400_sub0000000524",
      "uuid": "RINCON_3xxx01400",
      "host": "192.168.0.105",
      "service": "RenderingControl"
    },
    {
      "sid": "uuid:RINCON_0xxx1400_sub0000000381",
      "uuid": "RINCON_00xxx01400",
      "host": "192.168.0.109",
      "service": "RenderingControl"
    },
    {
      "sid": "uuid:RINCON_0xxx01400_sub0000000382",
      "uuid": "RINCON_0xxxA01400",
      "host": "192.168.0.109",
      "service": "AVTransport"
    }
  ]
}
svrooij commented 2 years ago

Care to create a PR for the documentation page? With your experience, so others won't struggle with the same issue.

Or maybe even a small donation to keep me motivated updating this app and providing support at Saturday evening?

The status endpoint is also no where described, I realize now. You can us it to see to which sonos devices your app is subscribed to.