home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.39k stars 30.29k forks source link

Sonos listener dies after a while. #69759

Closed oSourceSE closed 2 years ago

oSourceSE commented 2 years ago

The problem

Hi

I have 1 Ikea Symphony speaker connected to HA and it has been working great up to 2021-09 of HA, after that it has been really bad experience and it ends up being unavailable constantly and a restart of HA is required to get it up an running again, it stays connected for a few hours and goues away again.

I'm och 2022.4.1 and it's still the same issue.

During my tests i see that the HA integration stops respoding on port 1400 from the network.

If i do this after Ha is restarted from my computer, HA responds like it should and the speaker has contact.

nc -v 192.168.105.2 1400
Connection to 192.168.105.2 port 1400 [tcp/cadkey-tablet] succeeded!

But when i do the same when the speaker is unavailable, HA do not accept connections on port 1400 anymore.

nc -v 192.168.105.2 1400
nc: connectx to 192.168.105.2 port 1400 (tcp) failed: Connection refused

Nothing in my network has changed and yes i do run with VLAN:s, but have done that for a long time.

If i go to the web GUI on the speaker when it's unavailable in HA it still responds and i can see the info it provides and i can use the Sonos App from my phone to use the speaker, so it is alive, just not in HA.

/Marcus

What version of Home Assistant Core has the issue?

2022.4.1

What was the last working version of Home Assistant Core?

2021.9

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Sonos

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sonos/

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.4.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.9.9", "docker": true, "arch": "aarch64", "timezone": "Europe/Stockholm", "os_name": "Linux", "os_version": "5.10.103-v8", "supervisor": "2022.03.5", "host_os": "Home Assistant OS 7.6", "docker_version": "20.10.9", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.24.3", "requirements": [ "aiogithubapi>=21.11.0" ] }, "nordpool": { "version": "0.0.5", "requirements": [ "nordpool>=0.2" ] }, "feedparser": { "version": "0.1.7", "requirements": [ "feedparser==6.0.8" ] }, "krisinformation": { "version": "v1.0.3", "requirements": [ "jsonpath>=0.82", "xmltodict>=0.12.0" ] } }, "integration_manifest": { "domain": "sonos", "name": "Sonos", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/sonos", "requirements": [ "soco==0.27.1" ], "dependencies": [ "ssdp" ], "after_dependencies": [ "plex", "spotify", "zeroconf", "media_source" ], "zeroconf": [ "_sonos._tcp.local." ], "ssdp": [ { "st": "urn:schemas-upnp-org:device:ZonePlayer:1" } ], "codeowners": [ "@cgtobi", "@jjlawren" ], "iot_class": "local_push", "loggers": [ "soco" ], "is_built_in": true }, "data": { "current_timestamp": 450593.065624858, "discovered": { "RINCON_542A1B63442201400": { "available": false, "battery_info": {}, "hardware_version": "1.20.3.3-2.0", "household_id": "Sonos_jsyifsUNohV25ymQXVpWn68vby", "is_coordinator": true, "model_name": "SYMFONISK Bookshelf", "model_number": "S21", "software_version": "67.1-27100", "sonos_group_entities": [ "media_player.symphony_kitchen" ], "subscription_address": null, "subscriptions_failed": false, "version": "14.4", "zone_name": "Kitchen", "_group_members_missing": [], "_last_activity": 436673.150086224, "_last_event_cache": { "AlarmClock": { "time_zone": "ffc40a000503000003000502ffc4", "time_server": "0.sonostime.pool.ntp.org,1.sonostime.pool.ntp.org,2.sonostime.pool.ntp.org,3.sonostime.pool.ntp.org", "time_generation": "20000001", "alarm_list_version": "RINCON_542A1B63442201400:0", "time_format": "INV", "date_format": "INV", "daily_index_refresh_time": null }, "ZoneGroupTopology": { "zone_group_state": "<ZoneGroup Coordinator=\"RINCON_542A1B63442201400\" ID=\"RINCON_542A1B63442201400:3071866168\"><ZoneGroupMember UUID=\"RINCON_542A1B63442201400\" Location=\"http://192.168.10.101:1400/xml/device_description.xml\" ZoneName=\"Kitchen\" Icon=\"\" Configuration=\"1\" SoftwareVersion=\"67.1-27100\" SWGen=\"2\" MinCompatibleVersion=\"66.0-00000\" LegacyCompatibleVersion=\"58.0-00000\" BootSeq=\"12\" TVConfigurationError=\"0\" HdmiCecAvailable=\"0\" WirelessMode=\"1\" WirelessLeafOnly=\"0\" ChannelFreq=\"2412\" BehindWifiExtender=\"0\" WifiEnabled=\"1\" Orientation=\"0\" RoomCalibrationState=\"1\" SecureRegState=\"3\" VoiceConfigState=\"0\" MicEnabled=\"0\" AirPlayEnabled=\"1\" IdleState=\"1\" MoreInfo=\"\" SSLPort=\"1443\" HHSSLPort=\"1843\"/>", "third_party_media_servers_x": "2:J4xralHS3ckGDJ/TXmPpXs2itYCX9xVE5MfQfkSyPDova4SRDbSAwd8D4lC2bJscMSvWQ6UWry8oKjrHai3d8WN7sp6CUB+z2VHnR+CwC8roVhamW2RiI/J76D0XIUkTbGCdUsm6MTE7dKGNQcPUFGeL7qetcNIC8pZ2HSRZ4CKyr+hDKCbrESgkGPMHXyJDSHlNji3CM+rBcD9xysLoq9BbUg7KOViwmErRyAr/O+WSBo0pFN8IUJNwY6CeShTlkazoSDPbCBt4I00+1VarpwfcLTeGxUbQ9jsnBWYaD4LqjbjLrbd9DLkKGwWbNvtCRUfpu8ESHitpahqgfXl92DsYcsPqkLUm6nuYHIcMOOWx3D4WzEv5RzJ1zVVVAZCk0Gb5bURjRUHMA2or+GXOSLExMRMGeogjKYVuW76GKz6lNaWZAuWokCbbMya/W1hlQNcj/eYOShMfW6AIfguCZXNxlwWulHoCMB7TTKfeFMEPMx2s8TN51yjo6Z6DosQx9Eb5G93vkYAdsQEMOPIzksDoA5r/C5Glz9bKkW6aD/Rcs3XzmPHb5r7pBrRb0k/hJn7lXUIFnCi2qLa14nbMkNPNP9eMDI1+SSxR+3QxzSYHgpWLYuIjqgDvPSiWAwSej+LB8ASc77KLeHtVz9QrncD9VUiE12R1Lr9yKdbg2WLeA/R6Y/hM7K1f9E/p8eUWi2wfTINZh5sZx60SbYsvC+bATUTTjLuE6a3QC/Spy8WcqjmQjTLjIt2saWQhwt6uh9vk6HTxqke9QysJH9LXc7XZ8Y70rN6Rs84l7NJKhlnGjJEBlVDbByH/cXLPGr25", "available_software_update": "<UpdateItem xmlns=\"urn:schemas-rinconnetworks-com:update-1-0\" Type=\"Software\" Version=\"67.1-27100\" UpdateURL=\"http://update-firmware.sonos.com/firmware/Prod/67.1-27100-v14.4-bjaiyg-GA-1/^67.1-27100\" DownloadSize=\"0\" ManifestURL=\"http://update-firmware.sonos.com/firmware/Prod/67.1-27100-v14.4-bjaiyg-GA-1/update.upm\" Swgen=\"2\" LatestSwgen=\"2\" ManifestRevision=\"1647012270\"/>", "alarm_run_sequence": "RINCON_542A1B63442201400:12:0", "zone_group_name": "Kitchen", "zone_group_id": "RINCON_542A1B63442201400:3071866168", "zone_player_uui_ds_in_group": "RINCON_542A1B63442201400", "muse_household_id": "Sonos_jsyifsUNohV25ymQXVpWn68vby.Ml2Ep_AvFeab52JrZ6mQ", "areas_update_id": "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", "source_areas_update_id": null, "netsettings_update_id": "104" }, "DeviceProperties": { "zone_name": "Kitchen", "icon": null, "configuration": "1", "invisible": "0", "is_zone_bridge": "0", "wireless_mode": "1", "wireless_leaf_only": "0", "channel_freq": "2412", "behind_wifi_extender": "0", "wifi_enabled": "1", "settings_replication_state": "RINCON_542A1B63442201400,14,RINCON_FFFFFFFFFFFF99999,0,RINCON_542A1B63442201400,0,RINCON_542A1B63442201400,0,RINCON_542A1B63442201400,130,RINCON_542A1B63442201400,2,RINCON_542A1B63442201400,96,RINCON_FFFFFFFFFFFF99999,0,RINCON_542A1B63442201400,8,RINCON_FFFFFFFFFFFF99999,0,RINCON_542A1B63442201400,100,RINCON_542A1B63442201400,660,RINCON_542A1B63442201400,2,RINCON_542A1B63442201400,4,RINCON_542A1B63442201400,0,RINCON_542A1B63442201400,104,RINCON_542A1B63442201400,48", "secure_reg_state": "3", "is_idle": "1", "more_info": null, "channel_map_set": null, "ht_sat_chan_map_set": null, "ht_bonded_zone_commit_state": "0", "orientation": "0", "last_changed_play_state": "STOPPED,,,", "available_room_calibration": "542A1B63442201400_3.15.0.0_2021-09-19_12-23-57", "room_calibration_state": "1", "config_mode": null, "air_play_enabled": "1", "supports_audio_in": "0", "supports_audio_clip": "1" }, "ContentDirectory": { "system_update_id": "2", "container_update_i_ds": "FV:2,1", "share_index_in_progress": "0", "share_index_last_error": null, "favorites_update_id": "RINCON_542A1B63442201400,14", "favorite_presets_update_id": "RINCON_542A1B63442201400,13", "radio_favorites_update_id": "RINCON_542A1B63442201400,13", "radio_location_update_id": "RINCON_542A1B63442201400,130", "saved_queues_update_id": "RINCON_542A1B63442201400,0", "share_list_update_id": "RINCON_542A1B63442201400,0" }, "RenderingControl": { "volume": { "Master": "2", "LF": "100", "RF": "100" }, "mute": { "Master": "0", "LF": "0", "RF": "0" }, "bass": "0", "treble": "0", "loudness": { "Master": "1" }, "output_fixed": "0", "headphone_connected": "0", "speaker_size": "5", "sub_gain": "0", "sub_crossover": "0", "sub_polarity": "0", "sub_enabled": "1", "sonar_enabled": "1", "sonar_calibration_available": "1", "preset_name_list": "FactoryDefaults" }, "AVTransport": { "transport_state": "STOPPED", "current_play_mode": "NORMAL", "current_crossfade_mode": "0", "number_of_tracks": "3", "current_track": "1", "current_section": "0", "current_track_uri": "hls-radio://https://prod-pre.fns.tunein.com/v1/master/30ead7055f8b8e1f2f04add745f139b184df6925/prod_preroll/preroll0.m3u8?ads.cust_params=partnerId%253dSonosRadio%2526ads_partner_alias%253dceSonosApp%2526version%253d1%2526premium%253dfalse%2526abtest%253d%2526language%253den-US%2526stationId%253ds60236%2526is_ondemand%253dfalse%2526genre_id%253dg3%2526class%253dmusic%2526is_family%253dfalse%2526is_mature%253dfalse%2526country_region_id%253d210%2526station_language%253dswedish&ads.stationId=s60236&ads.ads_partner_alias=ceSonosApp&ads.url=https%3a%2f%2ftunein.com%2fdesc%2fs60236%2f&ads.description_url=https%3a%2f%2ftunein.com%2fdesc%2fs60236%2f&ads.npa=1&ads.gdfp_req=1&is_lat=1", "current_track_duration": "0:00:00", "current_track_meta_data": { "title": "", "parent_id": "-1", "item_id": "-1", "restricted": true, "resources": [ { "__type": "<class 'soco.data_structures.DidlResource'>", "repr": "<DidlResource 'x-sonosapi-stream:tunein%3a16916?sid=303&flags=8224&sn=1' at 0x7f67cfdf10>" } ], "desc": null, "stream_content": "", "radio_show": "", "album_art_uri": "/getaa?s=1&u=x-sonosapi-stream%3atunein%253a16916%3fsid%3d303%26flags%3d8224%26sn%3d1" }, "next_track_uri": "", "next_track_meta_data": "", "enqueued_transport_uri": "x-sonosapi-stream:tunein%3a16916?sid=303&flags=8224&sn=1", "enqueued_transport_uri_meta_data": { "title": "Guldkanalen", "parent_id": "-1", "item_id": "-1", "restricted": true, "resources": [], "desc": "SARINCON65031" }, "playback_storage_medium": "NETWORK", "av_transport_uri": "x-sonosapi-stream:tunein%3a16916?sid=303&flags=8224&sn=1", "av_transport_uri_meta_data": { "title": "Guldkanalen", "parent_id": "-1", "item_id": "-1", "restricted": true, "resources": [], "desc": "SARINCON65031" }, "next_av_transport_uri": "", "next_av_transport_uri_meta_data": "", "current_transport_actions": "Set, Stop, Play", "current_valid_play_modes": "", "direct_control_client_id": "", "direct_control_is_suspended": "0", "direct_control_account_id": "", "transport_status": "OK", "sleep_timer_generation": "0", "alarm_running": "0", "snooze_running": "0", "restart_pending": "0", "transport_play_speed": "NOT_IMPLEMENTED", "current_media_duration": "NOT_IMPLEMENTED", "record_storage_medium": "NOT_IMPLEMENTED", "possible_playback_storage_media": "NONE, NETWORK", "possible_record_storage_media": "NOT_IMPLEMENTED", "record_medium_write_status": "NOT_IMPLEMENTED", "current_record_quality_mode": "NOT_IMPLEMENTED", "possible_record_quality_modes": "NOT_IMPLEMENTED" } }, "enabled_entities": [ "number.kitchen_bass", "switch.sonos_kitchen_crossfade", "media_player.symphony_kitchen", "number.kitchen_treble" ], "media": { "album_name": "", "artist": "", "channel": "Guldkanalen", "duration": null, "image_url": "http://192.168.10.101:1400/getaa?s=1&u=x-sonosapi-stream%3atunein%253a16916%3fsid%3d303%26flags%3d8224%26sn%3d1", "queue_position": 1, "playlist_name": null, "source_name": null, "title": "Guldkanalen", "uri": "hls-radio://https://prod-pre.fns.tunein.com/v1/master/30ead7055f8b8e1f2f04add745f139b184df6925/prod_preroll/preroll0.m3u8?ads.cust_params=partnerId%253dSonosRadio%2526ads_partner_alias%253dceSonosApp%2526version%253d1%2526premium%253dfalse%2526abtest%253d%2526language%253den-US%2526stationId%253ds60236%2526is_ondemand%253dfalse%2526genre_id%253dg3%2526class%253dmusic%2526is_family%253dfalse%2526is_mature%253dfalse%2526country_region_id%253d210%2526station_language%253dswedish&ads.stationId=s60236&ads.ads_partner_alias=ceSonosApp&ads.url=https%3a%2f%2ftunein.com%2fdesc%2fs60236%2f&ads.description_url=https%3a%2f%2ftunein.com%2fdesc%2fs60236%2f&ads.npa=1&ads.gdfp_req=1&is_lat=1", "current_track_poll": { "Track": "1", "TrackDuration": "0:00:00", "TrackMetaData": "<DIDL-Lite xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" xmlns:r=\"urn:schemas-rinconnetworks-com:metadata-1-0/\" xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"><item id=\"-1\" parentID=\"-1\" restricted=\"true\"><res protocolInfo=\"sonos.com-hls-radio::audio/mpegurl:\">hls-radio://https://prod-pre.fns.tunein.com/v1/master/30ead7055f8b8e1f2f04add745f139b184df6925/prod_preroll/preroll0.m3u8?ads.cust_params=partnerId%253dSonosRadio%2526ads_partner_alias%253dceSonosApp%2526version%253d1%2526premium%253dfalse%2526abtest%253d%2526language%253den-US%2526stationId%253ds60236%2526is_ondemand%253dfalse%2526genre_id%253dg3%2526class%253dmusic%2526is_family%253dfalse%2526is_mature%253dfalse%2526country_region_id%253d210%2526station_language%253dswedish&amp;ads.stationId=s60236&amp;ads.ads_partner_alias=ceSonosApp&amp;ads.url=https%3a%2f%2ftunein.com%2fdesc%2fs60236%2f&amp;ads.description_url=https%3a%2f%2ftunein.com%2fdesc%2fs60236%2f&amp;ads.npa=1&amp;ads.gdfp_req=1&amp;is_lat=1</r:streamContent>preroll0.m3u8?ads.cust_params=partnerId%3dSonosRadio%26ads_partner_alias%3dceSonosApp%26version%3d1%26premium%3dfalse%26abtest%3d%26language%3den-US%26stationId%3ds60236%26is_ondemand%3dfalse%26genre_id%3dg3%26class%3dmusic%26is_family%3dfalse%26is_mature%3dfalse%26country_region_id%3d210%26station_language%3dswedish&ads.stationId=s60236&ads.ads_partner_alias=ceSonosApp&ads.url=https://tunein.com/desc/s60236/&amp;ads.description_url=https://tunein.com/desc/s60236/&amp;ads.npa=1&amp;ads.gdfp_req=1&amp;is_lat=1</dc:title>object.item</upnp:class>", "TrackURI": "hls-radio://https://prod-pre.fns.tunein.com/v1/master/30ead7055f8b8e1f2f04add745f139b184df6925/prod_preroll/preroll0.m3u8?ads.cust_params=partnerId%253dSonosRadio%2526ads_partner_alias%253dceSonosApp%2526version%253d1%2526premium%253dfalse%2526abtest%253d%2526language%253den-US%2526stationId%253ds60236%2526is_ondemand%253dfalse%2526genre_id%253dg3%2526class%253dmusic%2526is_family%253dfalse%2526is_mature%253dfalse%2526country_region_id%253d210%2526station_language%253dswedish&ads.stationId=s60236&ads.ads_partner_alias=ceSonosApp&ads.url=https%3a%2f%2ftunein.com%2fdesc%2fs60236%2f&ads.description_url=https%3a%2f%2ftunein.com%2fdesc%2fs60236%2f&ads.npa=1&ads.gdfp_req=1&is_lat=1", "RelTime": "0:00:00", "AbsTime": "NOT_IMPLEMENTED", "RelCount": "2147483647", "AbsCount": "2147483647" } }, "activity_stats": { "AlarmClock subscription": { "count": 1, "last_seen": 420472.986040912 }, "ZoneGroupTopology subscription": { "count": 1, "last_seen": 420473.084860838 }, "DeviceProperties subscription": { "count": 1, "last_seen": 420473.149982611 }, "ContentDirectory subscription": { "count": 1, "last_seen": 420473.490543658 }, "RenderingControl subscription": { "count": 1, "last_seen": 420473.565443847 }, "AVTransport subscription": { "count": 1, "last_seen": 420473.805928719 }, "SonosMedia.poll_track_info": { "count": 1, "last_seen": 420473.847026606 }, "timeout poll": { "count": 54, "last_seen": 436673.150086224 } }, "event_stats": { "AlarmClock": { "received": 1, "duplicates": 0, "processed": 0 }, "ZoneGroupTopology": { "received": 1, "duplicates": 0, "processed": 1 }, "DeviceProperties": { "received": 1, "duplicates": 0, "processed": 1 }, "ContentDirectory": { "received": 1, "duplicates": 0, "processed": 0 }, "RenderingControl": { "received": 1, "duplicates": 0, "processed": 1 }, "AVTransport": { "received": 1, "duplicates": 0, "processed": 1 }, "soco:from_didl_string": [ 1, 11, 128, 11 ], "soco:parse_event_xml": [ 0, 6, 128, 6 ] } } }, "discovery_known": [], "discovery_ignored": [] } }

Example YAML snippet

sonos:
  media_player:
    hosts: 192.168.0.101
    advertise_addr: 192.168.105.2

Anything in the logs that might be useful for us?

2022-04-09 00:42:10 WARNING (MainThread) [homeassistant.components.sonos.speaker] No recent activity and cannot reach Kitchen, marking unavailable
2022-04-09 00:42:10 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=media_player.symphony_kitchen, old_state=<state media_player.symphony_kitchen=paused; group_members=None, volume_level=0.02, is_volume_muted=False,

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

sonos documentation sonos source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @cgtobi, @jjlawren, mind taking a look at this issue as it has been labeled with an integration (sonos) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

jjlawren commented 2 years ago

From the diagnostics, it appears that you receive exactly one callback from the speaker on each subscription during startup, but no more. Do you have any firewall restrictions in place between subnets? Have you tried running without the YAML config for Sonos?

oSourceSE commented 2 years ago

Hi

Yes i do have firewall between and the from the speaker all is allowed, from HA i have opened the following ports to the network where the speaker exist, do not see any blocks in my firewall logs either.

1400,1900-1905,3400,3500

I have not tried without the YAML config, doing it now to see if it changes anything.

The service responing on port 1400 on the HA-Server stops responding, should'nt that one stay alive even if my speaker cannot talk back to it?

It work perfect up to november/december last year and nothing in my Firewall has changed since or around that time.

oSourceSE commented 2 years ago

Tried without YAML config and it will not connect, the service on HA is instantly dead and no contact between them.

jjlawren commented 2 years ago

The service responing on port 1400 on the HA-Server stops responding, should'nt that one stay alive even if my speaker cannot talk back to it?

Yes, it only stops listening if it never receives a subscription event from the speaker. You're receiving one, so it will keep listening. This appears to be a problem at the host or network level, not HA or its Sonos integration.

If this only works with hardcoded hosts in the YAML config, then multicast discovery (SSDP & mDNS) is not being bridged between the two subnets.

Perhaps try to see how it behaves when the HA host & Sonos speaker are on the same subnet?

oSourceSE commented 2 years ago

I will move the speaker to same subnet and see how that works, will get back asap.

davidmarah commented 2 years ago

Hi

I also see this problem, with a similar setup.

I have nine Sonos players, and as they're on a different subnet to Home Assistant I have them specified in YAML. There's no firewall between the subnets though.

Different players appear to become unavailable at random, roughly one every couple of days. The players remain available through the Sonos app, and I also have device_tracker entities in Home Assistant (provided by my router integration) that consistently shows the Sonos players as connected.

I have found a workaround that seems to make the Sonos players become available again. Running the sonos.join service with the unavailable Sonos device as the master will join the players as expected, and will instantaneously update the media_player status and allow it to work as normal (at least for a few days).

This did work as expected until the end of last year, and I've made no changes around that time. I've attached the full diagnostics here if that helps.

config_entry-sonos-629595d500584300b3dcff15b4aadae6.json (1).txt

jjlawren commented 2 years ago

@davidmarah I think your issue is slightly different and perhaps https://github.com/home-assistant/core/pull/69887 will help.

davidmarah commented 2 years ago

@davidmarah I think your issue is slightly different and perhaps #69887 will help.

Thanks, I'll wait for that fix to come through and see if it helps. I did later see the other issue, but didn't want to cross-post.

Thanks again

oSourceSE commented 2 years ago

My issue seems to be resolved by moving to the same subnet/vlan, been working much better now, but still strange that it had been working fine until november/december with no firewall changes, perhaps my switches is te real issue, they have been updated regulary with new firmware so perhaps thas has done something not desired in my network.

So this is resolved on my part.

Thanks for the support. :-)