Next Alarm sensor not updating / stuck in the past (Samsung Galaxy S22)

Just as the title describes, I’m having trouble with the Next Alarm sensor.
I use it to do a sunrise effect in the morning, and it used to work great on my old phone (LG V30, Android 9).
On my new phone (S22, Android 13) it has not worked at all for multiple months (Holidays, so no big deal, but now I would like it to work again).

The alarm app I use is called AMdroid, and I have already added only it and the Samsung clock app to the Allow List.

It seems to just not pick up any alarms (regardless of the app) until very shortly before, or not at all.

At the moment the sensor should show 12 September 2023 at 8:45, however it is still showing an alarm from last morning. The 11:20 alarm also makes no sense, because there was never an alarm set to 11:20, so no idea where that’s coming from.
Screenshot_2023.09.12_00:14:24

If anyone knows of a solution to this problem or a different way to read the next alarm, I would be infinitely grateful.

switch to a different alarm app, samsung apps are known to misbehave like this and set a lot of unexpected alarms using the API

Google clock and Sleep as Android are both known to make proper use of the API.

if you look at hte companion app logs (Settings > Companion app > Troubleshooting > show and share logs) you will see what app is causing the issue. I have seen Samsung Calendar to also interfere.

The API itself is very literal and only reports the next scheduled alarm and nothing else. So if another app is scheduled before yours you wont see an update until after the other apps scheduled alarm.

Bit late to the topic, but hopefully this is some help to someone having the same problem.

I still had the same issue after I deleted all alarms and then uninstalled Samsung Clock. Then tried both Google Clock and then Sleep (as Android), installed one at a time. Both apps still gave me incorrect or past alarms in HA.

Seems Samsung Routines was causing the problem as well. Opened Settings → Routines (app), then removed cache and data. Seems it was still having the Samsung Clock data.

From this point on Google Clock and Sleep worked like a charm.
Running Android 14 with Samsung One UI 6.1. all up-to-date march 2024.

3 Likes

THANK YOU!

I have been trying, on and off, to make use of the next_alarm sensor for months and had no luck. Samsung s22. I tried both alarm/clock apps as you, in addition to the stock clock. I have deleted, reinstalled everything many many times. I tried various settings and option sin the companoin app. I made sure the allow_list was correct for the sensor. If I restarted my phone, the next_alarm sensor would update to whatever was set at restart, but then any further changes did nothing.

The next_alarm would work at the next alarm time (and run a variety of automations) but turning off, snoozing or changing the alarm before that time did nothing.

What finally worked was clearing the data nad cache from the “Modes nad Routines” app. Took me a while to find it but its under Storage.

On my Samsung S22 (sm_s901w) that was found under:
Settings → apps → MOdes and Routines → Storeage → Clear Data/Claer Cache

I did clear the data/cache from all clock apps also but clearing those from Modes and Routines is what finally solved the issue. The next_alarm sensor now updates in HA almost instantly when I change any alarms or their settings. The next_alarm sensor now has state unavailabl eif there is no alarm set. Even the snooze works now, with the next_alarm updating to the new time as soon as snooze is used.

I’m using the Google Clock app (com.google.android.deskclock is the package when checking the sensor in the companion app settings) and I have only the Google Clock package allowed in the allow_list under the next alarm sensor in the companion app.

Android 14. One UI 6.1. up to date as of July 6 20204

Samsung certainly seems to have done some weird hacks or messing around with the Next Alarm API, I am currently hitting the same issue and none of the fixes online work.

I eventually found a fix and that was to disable all calendar views within either Samsung calendar or google calendar followed by a reboot.

For some reason, the calendar API on Samsung devices also sets an alarm, no matter the app!

I now have to either choose between losing my smart automatons around alarms or not having any calendar notifications…

I’ve had a look through the current implementation of the NextAlarmManager for android devices, I notice there is an early return if an item does not appear in the allow list (android/common/src/main/java/io/homeassistant/companion/android/common/sensors/NextAlarmManager.kt at f0a4cd5a6e45ce67c8751538755f80fbc30eda51 · home-assistant/android · GitHub) this does not trigger a sensor update by intention it seems

This varies from the sensor update that is triggered if alarmClockInfo is NOT defined which ends up being the case when you normally disable an alarm which makes the sensor unavailable, problem being on Samsung devices is the calendar instantly picks back up when you disable the alarm and puts in a stupid event as an alarm if you don’t have an allow list setup.

Damned if you do, Damned if you don’t - I can’t currently think of a solution that wouldn’t set the sensor as undefined accidentally

Edit: Yes, I’ve tried using google clock and calendar solely with the same issue.

delete all teh calendar entries from samsung calendar and use google calendar instead? i think by default they try to sync all entries and tahts usually what causes the problem.

I’ve tried all of this to no avail, I really thought using the Google apps would solve this (I have no entries in the samsung calendar and it is disabled, it however hooks straight into the Google account ones)

Have just discovered a solution and I’m currently testing to see if I get notifications correctly when they are meant to happen.

I have installed shelter (fork from island app) which isolates apps into work profiles, I’ve put the calendar inside that and it no longer inteferes with the next alarm API on my normal profile!

I’ll edit this when the notification is meant to happen to see if that still runs as intended.

Edit: the notification worked!

I’m having very similar issues…again.

I can’t get the next alarm sensor to update in a timely manner. it does update seemingly whenever it feels like it.

I set an an alarm for 9:30am last night at around 11:00pm. it finally updated to show the alarm as active at 12:00am. then when the alarm was cancelled this morning it still showed that alarm as active until 6pm.

now no matter if I set an alarm or not it will not update “instantly” as the sensor description says. It’s always unavailable. It might finally show up at some later time but I use setting the alarm in an automation so I really do need it to update right away.

it looks as tho something is blocking it from updating but I can’t figure out what it might be.

I have Sleep as Android (Sleep) as the only allowed package in the settings.

I’ve disabled and forced stopped the samsung calendar. And restarted the phone afterward.

I’ve checked to see if the samsung clock would affect it but it doesn’t have any effect either.

I’ve tried looking in the companion app logs but if I either set or cancel an alarm in SAA I don’t see anything in the logs for the next alarm sensor. Tho those logs are pretty informationally dense so it’s possible I’m just not seeing it.

this sensor has historically been kind of hit or miss at times but it’s been generally reliable recently. unfortunately now it’s pretty much unusable.

the only thing I know that I’ve changed recently is I updated the phone (S21 Ultra) software a couple of days ago.

I’m kind of stuck on troubleshooting this at this point.