-
-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Samsung - alarm_stream notifications still silent #1465
Comments
Were going to need help from a developer who has a samsung device and is familiar with the API changes they have done. I can see the proper ringtone being grabbed but still unused. I cannot reproduce on my pixel and I know other manufacturers do not have issues. |
@dshokouhi I have a samsung tablet. Can i help you with debugging? |
I suppose we could add some more debug logs but based on what I see in the logs above the ringtone URI is successfully retrieved but the notification call strips it out for some reason. I dont know if its something samsung has done to the actual notification API or not but I know resorting to media player/ringtone player is not desireable as the audio wont stop naturally like it does on my pixel. Honestly not really sure where to start with it, everything about hte code suggests it should work. Based on the logs above I know my assumption was correct in that the default alarm ringtone was null but not sure why the ringtone itself wont work when its not null. Can you reproduce it on the tablet? |
Just did a quick test with my samsung tablet and send the same alarm notification as jojeda654. No problems here. |
So I am not sure if this is the actual issue however I noticed the following sentry error for a couple samsung devices that suspiciously call out the updated code
Now heres the tricky part, we don't normally do a permission request for a normal notification being received. I also only see Samsung devices with this issue. So while we can add the permission to our manifest users still need to grant the permission on an additional screen that is not the same as a normal permission. WRITE_SETTINGS requires the user to grant it for the app on a separate activity. As this is only a samsung issue I am hesitant to add a check like we normally do because we don't want to prevent an already working notification on other devices. I think we may just opt to add it to the app manifest and keep it as a troubleshooting step for users to enable if they experience issues. I am also not even sure if this permission will work. We may indeed get a separate error on these devices after we pass this step. Also why do we need a WRITE permission if we are just reading the URI? Setting a notification channel sound doesnt require special permissions. This is just odd :) |
I have the same issue on 2 devices: Samsung Galaxy A40 and Samsung Galaxy S8. |
notifications do not work in debug builds unfortunately....are you able to see the error I just posted above in your logs? it would be helpful to know if you do :) |
I have no error in logs. |
@RudyWI can you check if you have a default alarm ringtone set? Have you set an alarm on the device before? |
And why does this work without this permission on my samsung tablet? Also this permission should be used on all devices. Thats really weird. |
Yea the error above suggests all users should be hitting it but its the first time I have seen it so it tells me the initial hunch that the alarm ringtone was |
My log:
There is no "alarm ringstone" parameter in my phone. When I set volume up manually and then send the alarm notification from HA, the phone is ringing. I have discovered in my phone that there is no "alarm volume" that appears when I press volume up or down buttons. When an alarm is ringing, the phone seems to use "ringstone" volume level |
so the app will default to the devices ringtone if you dont have an alarm one set, we can see that in the logs above
What do you mean by this? Do you mean to say the volume was at 0 and then it started to make a sound when you sent the notification?
Can you enable the alarm volume sensor and see what value you get for the state?
Compare the 2 volume sensor for ringer and audio and see if they are always the same or not. It looks like the fix I submitted will not be accepted. If someone can please setup the project according to the full readme instructions including the firebase stuff for notifications and then try the linked PR locally to see if it will work or not. We will probably need to hold off on future fixes until someone can reproduce this who is a developer to help out. |
I set ringtstone volume to max using "volume up" button on my phone. And then it started to make a sound when I sent the notification on "alarm_stream" channel.
When "alarm" sensor is at 15 and ringstone sensor is at 0, my phone is not making sound when I sent the notification.
I'm a java and web developer, not android. I'll try to setup the project. |
I have setup project localy and applied your PR, but it does not solved the problem (alarm is still silent) :-( |
So I think you may be on to something about the device not having an alarm stream. I would think looking into how your actual alarm sounds off on the device may be helpful. Logcat could potentially provide some clues as to how it works. Tasker might be a good place to check as well. There will need to be research done to find a good path forward. Its very strange that an alarm stream is missing if that is the case. Can you try a TTS alarm stream notification? https://companion.home-assistant.io/docs/notifications/critical-notifications Try the last 2 examples, this uses a completely separate API from notifications as its TTS to access the alarm stream |
I tried the last 2 examples: TTS over "alarm_stream" and "alarm_stream_max" channels. |
I have a Samsung S21 and can confirm when my phone is on silent/volume 0 TTS works but nothing else does. Is this as expected? I guess I can have TTS saying "weeeeewoooooo alert alert" ;) |
Per the description of this bug, yes Samsung devices do not work with this API call which is documented in Android dev docs. TTS uses a completely different API and luckily Samsung did not modify that. Alternatively you can use notification commands to change device ringer mode, DND and volume level so you can definitely get around this today. https://companion.home-assistant.io/docs/notifications/notification-commands |
Maybe we should write this into the app documentation? I spent a lot of time trying to figure out why it didn't work. Another workaround is to use Tasker, then you can catch when Home assistant sends a notification with a certain text, I write "Important" in the beginning of the title for example, and make it sound louder and circumvent dnd. |
Hey everyone so a few weeks ago I reached out to Samsung as they had reached out with bug reports so I thought about asking them about this issue. Here is the response from their dev team.
So they did provide a workaround which will be a lot of work as it will involve the app using a media player in the background which will also require us to use a pre-defined notification sound. More than likely we would need to stick to whatever the default alarm or ringtone is without much option to change. This also means that it will not work as a normal notification, there will be no notification channel to allow for DND overrides. I am not sure this will be sufficient for our actual use case here especially if its only going to be a workaround. For now I think its best that if you hit this issue you continue to use app provided features to workaround this in an automation. There are sensors to check the DND/ringer mode state and also notification commands to take them in and out of the state. I understand that its still not 100% the same but until they can fix this on their end there is not much the app can do. The good news is that they are aware and the change made seems to be deliberate so hopefully they can open it up for the alarm stream. If I hear anything else I'll make sure to update this thread. |
Thanks for the update.
|
I have Samsung S21 FE, even with do not disturb off I cannot get any ringtone to play, even tried increasing the volume using command_volume_level but it doesn't increase the volume |
check your notification channel settings
lets not combine multiple issues into one. please create a new issue providing the logs and YAML used so we can troubleshoot. Also make sure the proper permission is granted for this command. |
pro tip: try assigning a new notification channel whenever you change some parameter, as Android seems to cache them when a notification channel is first created (at least this is my experience). I always name my notification channels like |
yes that is correct certain parameters can ONLY be set the first time you create a channel. Vibration and LED color are some of them. We detail this in the docs here: https://companion.home-assistant.io/docs/notifications/notifications-basic/#notification-channels Deleting a channel also only removes the channel from the list, the settings are still restored when its recreated. The only way to truly clear those one time settings is to clear data in the app. |
@dshokouhi until I put the ringer volume on, nothing works, can you please look at the attached and let me know if you find anything I'm doing wrong, thanks! Button YAML:
Find phone script(calls 2 other scripts to volume up and ring phone):
Volume Up:
Ring phone:
alarm_stream notification settings: |
@Ali229 use a different channel other than |
Didn't change anything same problem only works when ringer volume is up |
are you sure you are changing the ringer mode to Lets please stop conflating this issue with something unrelated. If you are unable to figure it out please create a new issue with all the YAML you used along with device logs. |
How is it possible that the most basic alarm apps (even 3rd party) have alarm notifications figured out, but HA can't... |
We are not an alarm app so that not a fair comparison and the notification that we post is different. There is code in our notification to explicitly override the default notification stream and use the alarm stream. This is what Samsung has blocked apps from using while other manufacturers haven't blocked it. |
And the new policy doesn't allow HA to do alarms I guess... |
It's not about a new policy just something Samsung deliberately decided to change. Feature works fine on other devices. |
Then just add the alarm permission and work the same route as the Google clock then? That way you can also allow access to alarm sounds instead of the notification sound. |
It's not that simple but please if you feel it is feel free to submit a pull request. |
I recently installed Ntfy (developed by a single person) on my Samsung S23 and that has zero issues punching through DND and silent mode. Might be worth investigating how that can do it. |
But does it do the workaround method or is it actually as good as you describe it? |
That has nothing to do with the code we are using. The issue here is that Samsung has deliberately stopped an app from overriding the audio attributes used when a notification is posted. Changing to Ntfy wont change how Samsung interprets the code which is used in this case. In the case of Ntfy they are actually creating a media player instance to change things instead of overriding the actual notification sound. Which means that it won't be tied to the notification and won't stop as expected possibly? The issue here would be the behavior change would be considered breaking and we have no way of knowing which devices need to use this method and which do not as not all Samsung devices exhibit this issue. The other issue here is that a user will not be able to change alarm sound played and will be stuck with whatever is in the code. The current code in our app is a great solution for majority of devices as users can still control the notification channel and pick something that will be louder and longer for them. The code in Ntfy below picks your default notification sound and puts it on loop. Sounds like a good job for Tasker which then would allow you to change the sound used instead of being stuck to a sound that may not be loud or long enough. |
So they went with a shitty workaround. Thanks for the elaborate explanation. |
Just arrived to this thread because I've noticed that the Pixel 6 on Android 14 is also having the same problem, using the alarm notifications sound doesn't work, however using TTS works fine. Whats also interesting (back to Samsung) is that this works on the SM-A415F without any issue, but not on the SM-S918B. Perhaps some changes in newer versions of OneUI / Android 12+? EDIT: Notifications work fine on the SM-S918B, I have a watch connected which when it is on my wrist all notifications are muted on the phone. |
Tested just now on my Pixel 8 Pro on android 14 and alarm stream notification worked as expected, please make sure your alarm stream volume is turned up otherwise it will sound silent.
|
Alarm volume set to max, and still no sound. An alarm set via the clock app for example works fine. This isn't a deal breaker for me though, I only use the alarm stream as a "find my phone" alternative. |
If anyone looks for a solution to find a lost Samsung device using TTS is a useful option that is not affected by ringer mode or even DND (from: https://community.home-assistant.io/t/notify-android-device-and-overwrite-ringer-mode-to-always-play-a-sound/583926/7) alias: Find My Phone
icon: mdi:cellphone-marker
sequence:
- service: notify.mobile_app_samsung_galaxy_s22_ultra
data:
message: TTS
data:
ttl: 0
priority: high
importance: high
media_stream: alarm_stream_max
tts_text: >-
Hey dumbass. Did you lose your phone? I'm over here. Hurry the hell up
and come get me.
mode: restart |
Hi, Is there any hope that it will be solved....., by Samsung or HomeAssistant? I have also tried solutions where the silent-mode will firstly be changed using "command_ringer_mode": I cannot manage to call the 2 services ther, i.e. first changing the silent mode and then sending the notification.... here is what I tried in ALARMO:
many thanks |
What the hell is silent mode and full silent? I only have sound, vibration, silent (and DND, not in the sound options though). S23 also |
Home Assistant Android version: beta-637-94e1f15
Android version: 11
Phone model: SM-G991U
Home Assistant version: 2021.3.4
Last working Home Assistant release (if known):
Description of problem: alarm_stream notifications still silent installing latest beta and fresh start. Configuration below:
Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):
Screenshot of problem:
Additional information:
The text was updated successfully, but these errors were encountered: