Closed koshisan closed 1 week ago
Hey there @jjlawren, @peterager, 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)
sonos documentation sonos source (message by IssueLinks)
Please provide debug logs and diagnostic file.
Do you have the ability to run with this pull request. #121853
Thanks for getting back to me so quickly!
I attached a HA debug log and the xml from one of the speakers (I hope this is what you mean by diagnostic file).
Running the pull request would mean cloning the branch and overwriting the integrated extension, right? Not sure if I could manage, but I could try.
However - the description doesn't really seem to match my problem. Its not that the integration mixes up my speakers when I group them. Its that there is one of the speakers shown with an IP that doesn't exist at all and I have no idea where it might come from...
home-assistant_sonos_2024-07-23T07-05-53.327Z.log Sonos Support Info.xml.log
Your system is not healthy. There are many errors unrelated to Sonos including time out errors. I suspect you have a misbehaving custom integration that is blocking the event loop and causing the timeouts. Consider disabling these custom integrations.
Your Sonos system is also connected via homekit? And homekit is complaining that you have over 150 devices.
Thanks! I will take a look at it! But as for the other timeouts in the log: Those are devices that weren't turned on at the moment I generated the file. I was not aware that this is problematic and might interfere with the system as a whole... As for HomeKit: This was indeed a configuration error on my side. I am not using Apple's Ecosystem at all - its just that I have a couple of sensors I cannot access otherwise. However, there is no need to publish any of the devices from HA to HomeKit... This has now been corrected. However: I don't think this explains why the speaker C4:38:75:78:3F:D6 is still listed as offline with the wrong IP. Neither its MAC address nor the IP that is falsely detected (192.168.81.91) are mentioned in the debug log at all. It is - however - correctly identified in the Sonos diagnostic file with its correct address 192.168.81.231 as "Wohnzimmer back (R)". This address is found in the debug input of soco.events_asyncio - however, it does not seem to update the entity for whatever reason. This problem also persists on days when access to other speakers is stable (yes, there are those...)
One additional observation: Speakers 54:2A:1B:42:84:76 and 54:2A:1B:40:97:2A are also marked as offline in the integration (although they do have the correct IP this time). Each of these speakers is part of a stereo set! The other partner of that set is controllable! I understand that it would make sense just to provide one media player instance for the set - but shouldn't the entities vanish completely in that case? I also have a sub that is paired to a speaker - the sub is never listed as a seperate entity...
Please enable debug logging for the integration, you do this from the integration panel.
Restarts HA and then send the debug log once the system has started. Record your observations.
Then from the integration panel download the diagnostic file.
The prior log did not have debug enabled for Sonos. The diagnostic file posted, while useful, was from Sonos not the integration.
A stereo pair is composed of two speakers with two ip addresses. Sonos marks one of the speakers as "invisible", and it should not show up in the integration as an entity.
Are you configuring ip addresses in configuration.yaml for Sonos?
Before doing those steps, I'd suggest removing the integration, restarting HA, and reconfiguring it, then enable debug logging and restart.
As for debug log generation: Strange - thats exactly how I did it, though... I have now deleted and re-added the integration and now it looks as described: The Stereo pairs are shown as one speaker only and everything has the correct IP. I also have not seen any cut-outs since then, but its too early to say if the problem is finally resolved. I still have the IPs configured in configuration.yaml, but from the log entry I had the impression that this is just ignored if autodiscovery is working...
The configuration.yaml entries do feed a separate section of code regardless of whether discovery is working. Since your system does not need them, they should be removed. There could be some kind a contention between the code pieces when a speaker is autodiscovered at the same time a manually configured connection from configuration.yaml is being setup. There is also no automated testing for that scenario.
@home-assistant close
The problem
Basically the same symptoms as in #88341 - but with some added quirks:
I have various speakers in my house. The are all connected to the very same WiFi AP. One of my Sonos 5 speakers has a wired connection - also to that very same WiFi AP. The AP has an 10G uplink to a switch - that switch has uplinks to my router and various other devices.
The main issue is - like I said - that some of my speakers become randomly unavailable. It basically never happens with my Roam speakers. It also never happens with the Sonos One in the Kitchen. It happens all the time with my Play:5 (Second gen) and the two Sonos One (SL) speakers I use in the living room. This is also were the AP is located. The Play:5 is the speaker directly wired via ethernet - even though it also does vanish.
The effect is the same with the new app - though not at the same time! sometimes speakers are available through HA even though the app cannot find them. Sometimes its the other way around.
The most important thing: I did run a ping-test to all speakers over several days - not a single packet was lost. All speakers have static IPs set in my router.
Now for some logs:
On startup I get:
2024-07-23 15:08:20.783 WARNING (MainThread) [homeassistant.components.sonos] Automatic discovery is working, Sonos hosts in configuration.yaml are not needed
This is an obvious lie though, because:
2024-07-23 15:08:15.812 WARNING (MainThread) [homeassistant.components.sonos] Could not get visible Sonos devices from 192.168.81.231: HTTPConnectionPool(host='192.168.81.231', port=1400): Read timed out. (read timeout=9.5)
This is indeed one of my speakers! It answers to ping and I can read the website through the browser!
After that I am getting a lot of other timeouts, too: 2024-07-23 15:42:13.688 WARNING (MainThread) [homeassistant.components.sonos.speaker] Creating subscription failed for Wohnzimmer: Request timed out
It would be easy to say that this would be related to my network "somehow" - however, I don't have any latency issues with any other devices. I have three cameras running over WiFi just fine. Also the wired speaker shows exactly the same behaviour with the same timeouts! Ping time is below 1ms...
I am wondering if there might be something wrong with leading to high load on the speakers themselves. The problems are often gone after a reboot, but only for a couple of minutes...
There is also another issue: The integration always shows one of my speakers with an IP of 192.168.81.191 - this is wrong! The speaker has 192.168.81.231 and does answer under that address! I did completely reset and re-add it through the app, but the problem stays. It is configured with the correct IP in the yaml - but according to the first entry this is ignored... Zoneplayer info also shows that speaker with the correct IP...
What version of Home Assistant Core has the issue?
core-2024.7.3
What was the last working version of Home Assistant Core?
No response
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
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response