Open jmwhite5 opened 1 year ago
Yup - see issue #38 that I opened a couple weeks ago. Same issue.
The issue went away this morning. I haven't changed or upgraded anything. Strange.
For me the error has been showing up in the log at roughly 24 hour intervals.
Same for me happened from today. Reloading or restarting HA is no solution.
`Logger: custom_components.sonos_cloud Source: custom_components/sonos_cloud/init.py:78 Integration: Sonos Cloud (documentation, issues) First occurred: 09:18:44 (96 occurrences) Last logged: 11:21:38
Household request failed (401): {"fault":{"faultstring":"Invalid Access Token","detail":{"errorcode":"keymanagement.service.invalid_access_token"}}}`
Started seeing this in 2022.12.0
too. I upgraded to 2022.12.3
and the integration had further issues where it didn't load.
I dropped the integration be removing it and when prompted had Home Assistant remove the application credential. Once removed I added the integration again using the same Sonos Developer client ID and secret and it was working again.
I did have to rename my entities in line with what they were previously but that is no stress to have this up and running again.
+1
Any ideas when this will be fixed, or is there an alternative to use rather than this add in. I reply on Sonos TTS for various alerts around the house, water leak sensors, doorbell notifications, smart door locks etc, and such like, and it's really frustrating that this doesnt work more than it does.
Any ideas when this will be fixed, or is there an alternative to use rather than this add in. I reply on Sonos TTS for various alerts around the house, water leak sensors, doorbell notifications, smart door locks etc, and such like, and it's really frustrating that this doesnt work more than it does.
@Steveelliott111 did you try the fix above?
@jjlawren I'm still seeing this issue in my logs. I have uninstalled SONOS Cloud and the credentials a few times and reloaded... the error comes back within a few days.
"Play request failed (401): {"fault":{"faultstring":"Invalid Access Token","detail":{"errorcode":"keymanagement.service.invalid_access_token"}}}"
Any suggestions?
I'm getting this also, the access token expires and the only way to renew it is to delete and re-add the integration which fixes it temporarily
It makes audio announcements something you can't rely on because it can break at any time.
I "think" I have seen this once since my comment in December 2022. This was in the last week or two. I got it back by reloading the integration. Didn't think anything of it. I'll see if I still have the logs and can find anything more specific. I'm always running the latest build or the beta depending on the monthly release cycle timing.
I have been wrestling with this issue off and on the past few weeks, where the integration would stop working until either the next morning or until I restart HA; reloading the integration would do nothing, and it would show as failed to load on the integration screen ("Retrying setup: None").
Each time it happened, it seems like it would happen in the evening, which makes me wonder if we have an issue with timezones; I'm in CDT (GMT-5). Thinking in timezones breaks my brain a little, but is it possible that the expires_at
for the access token is being misinterpreted as being good for longer than it should? The integration typically fixed itself by morning. Even this doesn't seem too likely, though, because I wouldn't have this issue every evening, just every few evenings.
Well, this was the behavior until last night; this time it broke, but it did not fix itself, and no amount of restarting HA helped. I had to remove and reconfigure the integration (opting to remove the application credentials when prompted). If I still see the behavior described above, I'll try to keep a better journal of exactly how often and at what time of day the issue occurs.
This completely broken behavior makes me wonder if there are two problems at hand here, though. I tried digging through the Sonos API docs and couldn't find this info, but does anyone know whether the grant associated with the refresh_token has a limited lifetime? i.e. are we supposed to be able to refresh the token indefinitely, or do we need to re-auth at some point?
Also... side question... does anyone know how to get better logging to try to diagnose this? The only information I've been able to get out of my logs has been the message listed in the main issue's description.
Sorry for the lack of response so far. I've taken several attempts at reproducing the issues described but I have not been successful.
That being said, I've been working on an alternative approach and HA 2023.5 will include a built-in support for the announce
feature on TTS announcements and media_player.play_media
(new language in the docs here). This will provide functionality similar to sonos_cloud
but via local websockets instead of a cloud service.
Once the 2023.5 beta is available (or in dev
today if you're particularly adventurous), you'll be able to test without needing a custom integration. Assuming the features are on par, that will likely be the way forward for Sonos announcements.
That's great news, I've been trying to nail down what causes this to no avail. Sometimes it will go weeks without issue then it will happen twice in a week.
Bringing this functionality into HA will be very useful, as long as the features are on par with this integration as you mention.
@jjlawren - Thank you for the update. I have been using the normal Sonos integration with the announce feature for the past week and it has been working great so far. I got rid of the Sonos Cloud integration entirely.
I've just switched my setup to do the same, and it seems promising so far! In case anyone else was using the extra volume
parameter to play announcements at a different volume than your media... remember to switch it to an integer percentage.
I thought the change wasn't working, but it was because I was asking for a volume of 0.35
, so I just couldn't hear it. I've corrected it to 35
and it seems to be working the way I hope!
@jjlawren That great. I just switched away from using the Sonos Cloud integration as well. Everything seems to work OK except for one thing, when I use a media_player group I get the old behavior where the music is stopped instead of the announcement overlay (with sound ducking). Should I file a bug for this?
@jjlawren That great. I just switched away from using the Sonos Cloud integration as well. Everything seems to work OK except for one thing, when I use a media_player group I get the old behavior where the music is stopped instead of the announcement overlay (with sound ducking). Should I file a bug for this?
Make sure you're on 2023.5 and that you're passing the announce: true
parameter.
Some old hardware doesn't seem capable of "mixing" the audio together and will instead silence it while playing the announcement, but it should still automatically resume afterwards.
Sorry, I meant I’m using the tts.cloud_say service. It works fine when I target a Sonos directly. But doesn’t when I use a media_player group. And yes, I’m running 2023.5.
On May 10, 2023, at 11:09 AM, jjlawren @.***> wrote:
@jjlawren https://github.com/jjlawren That great. I just switched away from using the Sonos Cloud integration as well. Everything seems to work OK except for one thing, when I use a media_player group I get the old behavior where the music is stopped instead of the announcement overlay (with sound ducking). Should I file a bug for this?
Make sure you're on 2023.5 and that you're passing the announce: true parameter.
Some old hardware doesn't seem capable of "mixing" the audio together and will instead silence it while playing the announcement, but it should still automatically resume afterwards.
— Reply to this email directly, view it on GitHub https://github.com/jjlawren/sonos_cloud/issues/39#issuecomment-1542609763, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJOAMVNIUBD5ZKFTASWWKTXFPKULANCNFSM6AAAAAASQAL2GY. You are receiving this because you authored the thread.
Sounds like an issue with the media player grouping behavior in HA core. I'd suggest to open an issue there.
Will do. Thanks!Sent from my iPhoneOn May 10, 2023, at 13:26, jjlawren @.***> wrote: Sounds like an issue with the media player grouping behavior in HA core. I'd suggest to open an issue there.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
Everything seems to work OK except for one thing, when I use a media_player group I get the old behavior where the music is stopped instead of the announcement overlay (with sound ducking).
I don't want to keep this conversation going here too much because it doesn't apply to this custom integration but this might help someone else.
I noticed this behavior too, but I did a quick test and it does have the expected behavior with an "old-style" group (group.[...]
instead of media_player.[...]
) - with the "new-style" media_player group music stops with the announce: true
parameter, but with the "old-style" group media ducks, the announcement plays, and media continues to play at the previous volume afterwards.
@jmwhite5 if you created an issue in HA core can you link to it? I'd like to follow so I know when I can stop using this workaround. Thanks!
Actually, I haven't file a bug yet @claytonjn. But the more I think about it, I'm not convinced that it's a media player group issue, because my group was working fine with the Cloud Sonos integration. There's something about this enhanced Sonos integration that doesn't handle groups the same way. @jjlawren feel free to give me more context if you feel otherwise and I'm happy to file an issue.
I haven't looked into it all, but the cloud integration always used the overlay method. It was not controlled by the announce
option. I assume that's not being passed down the line.
@jjlawren Thanks for this additional info. I filed https://github.com/home-assistant/core/issues/93046 to track the media_player group issue.
I've been using this integration for months without any issues.
Suddenly, I started getting this error:
2022-11-30 11:49:43.654 ERROR (MainThread) [custom_components.sonos_cloud] Household request failed (401): {"fault":{"faultstring":"Invalid Access Token","detail":{"errorcode":"keymanagement.service.invalid_access_token"}}}
What's the process for providing updated credentials?