I have a wake-up light automation that runs 15 minutes before sensor.sm_s926b_next_alarm. This has worked reliably for months if not years. Nothing has changed: no edits to the automation, allowlist for the sensor is set to com.sec.android.app.clockpackage only so there is no interference with other apps settings alarms or times, same phone, same setup. It worked exactly like this for a long time and then recently stopped a couple of days ago, with no changes on my end whatsoever.
alias: Custom Wake-up Light Alarm with Sunrise Effect
description: >-
A wake-up light alarm that starts 15 minutes before the alarm time (only for
alarms between 7:00-11:00)
triggers:
- trigger: time
at:
entity_id: sensor.sm_s926b_next_alarm
offset: "-00:15:00"
conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: "off"
- condition: time
after: "06:44:00"
before: "10:45:00"
alias: Only run in the morning
actions:
[...]
I've omitted the actions because it's unrelated to the issue. The automation does not trigger at all anymore, Traces have been completed empty even though I set an alarm every morning and I also did set several alarms during the day yesterday trying to troubleshoot.
How it used to work:
I'd set an alarm late at night and the sensor updated to the new time immediately.
Set at 1:36AM to 8:30AM the same day, automation triggers at 8:15. Then Next Alarm then becomes unavailable at 8:34AM (probably because I hit snooze once then turned the alarm off 4 minutes later).
What happens now:
I set an alarm overnight (still connected to Wifi etc of course). I can still see the correct alarm times updated immediately under DevTools > States > sensor.sm_s926b_next_alarm, however, the history tab does not reflect that at all as you can in the example below.
In the history tab the alarm set to June 28 9:05AM shows the sensor only registered that at June 28 10:29AM at which time this alarm isn't even set anymore and has longed been deactivated. The sensor also does not longer become unavailable at all at any time even when there is no alarm set.
Since I did not change anything about the automation or my phone and it has been working fine for a very long time, the only two changes made were: updating the Companion app and updating Home Assistant. Any ideas on that?
I'm in the same situation. The next alarm sensor was working flawlessly for years... until now. I have made some tests and saw that if I set an alarm at 21:59 it updates inmediatly in the sensor, but it doesn't if it is set at 22:00. Im at GMT+2, so the alarm is set ok at 19:59 and fails at 20:00. Clearly, there is a bug somewhere.
Re-enabled my next_alarm sensor yesterday when I read your thread, & I can confirm something funny is indeed going on, but can't reproduce your actual issues..
From what I can tell, the sensor is only updating with the next alarm when the next midnight comes around. Weirdly for me, it only happens with repeat alarms. I set an alarm yesterday at 19:40 for 19:45. I updated immediately, but was stuck on 19:45 till 00:03. Once midnight rolled around, the sensor picked up the correct alarm time at 07:15. Did the same thing just now with an alarm set for 2 minutes later & it also updated immediately & is still stuck there.
It's been a while since I disabled the next_alarm sensor, but I seem to recall it has always behaved that way. Not quite sure why, but there's 2 plausible options:
The underlying alarm app (Sleep as Android in my case) doesn't update its data for recurring alarms until the actual alarm day starts. In your cases, it might simply not be sending any updates.
Something else is blocking the alarm despite not being on the Allow list. In my case, I only allowed Sleep as Android (com.urbandroid.sleep). In the logs, I can see entries stating:
NextAlarmManager: Next alarm is scheduled by com.xiaomi.calendar with trigger time 1782943200000
NextAlarmManager: Skipping update for com.xiaomi.calendar as it is not in the allow list
Pretty sure both points above are expected behaviour. I could look up the other half dozen next alarm threads & check, but I'm not that invested in it as long as it updates before the actual alarm time.
@SeBB00@ElMonty Check your Companion App logs (Settings > Companion App > Troubleshooting > Show & Share logs) right after you set the alarm.
Look for any entries starting with NextAlarmManager- are there any entries in the logs for the time you actually set the alarm? Not the alarm time, but the time you actually created the alarm on your phone & enabled it.
07-02 10:58:54.085 3113 16672 D NextAlarmManager: Next alarm is scheduled by com.android.providers.calendar with trigger time 1783000800000
07-02 10:58:54.085 3113 16672 D NextAlarmManager: Skipping update from com.android.providers.calendar as it is not in the allow list
Same as yours since I also do not have and not want the calendar app in the allowlist.
The skip itself is expected and correct, but I am assuming that even though the update is skipped, it still affects how the sensor is set: while the calendar owns the slot the sensor just keeps its last value, never goes unavailable anymore, and my actual clock alarm never comes through.
Overall it is a mess right now, with the app logs, the sensor history, and DevTools all showing diverging states. But as far as I can tell this is not on HA or the Companion App.
I did actually get the automation to run yesterday by accident:
I set my alarm, as expected automation failed to trigger. I wake up, disable the alarm, browse my phone, see that my morning meeting has been canceled, so I set another alarm to sleep another 30min and the automation did start running 15min later. So it worked. I tried setting different alarms, also playing around with reminders in the calendar app to see how it affects it but as I am saying, app logs, sensor history, DevTools reading, a lot of it does not make sense and unfortunately I am too busy at the moment to investigate further. I'll just have to set my wake up schedule differently and remove the time trigger for now. Sucks because it adds an extra step of 1) alarm on the clock app 2) setting the same time somewhere in HA for the wake up sequence but that's gonna be it for now.
In my case I see this in the logs, which is correctly filtered as I have com.google.android.deskclock in the allowedlist:
07-02 19:50:11.485 26281 20237 D NextAlarmManager: Next alarm is scheduled by com.miui.securitycenter with trigger time 1783022400000
07-02 19:50:11.485 26281 20237 D NextAlarmManager: Skipping update from com.miui.securitycenter as it is not in the allow list
When I change the alarm some of them show in the logs and others don't:
This is an alarm at 20:20 (set at 19:53):
07-02 19:53:54.319 26281 6882 D NextAlarmManager: Next alarm is scheduled by com.google.android.deskclock with trigger time 1783016400000
And that is captured correctly. However if I set an alarm at 23:20 it doesn't show at the logs and the next alarm sensor is still at 20:20. I have noticed that depends on the houf of the alarm, like it only considers the next few hours. If I set the alarm at 21:20 it is captured correctly, however if the alarm is set at 22:20, it doesn't.
I will keep the 22:20 alarm to see if it is detected later, I will check at 22h tonight. I suspect it will not be detected. I have an automation at 3am that captures the next alarm (usually at 7:35 or 7:45) to trigger the covers opening, it was working fine for years until a few days ago.
I will let you know it the 22:20 alarm is detected later.
It's called next alarm. It's not going to show you the one after that. Yesterday you said you lived in a GMT+2 timezone. You posted this at 20:04, meaning the next alarm is your 20:20 one & hadn't triggered.
Did it update to 23:20 now that your other alarm has triggered?
If you want to test your theory out, it's simple. Tomorrow morning set your alarm to 11pm, give it a couple of minutes to update & check. Then, set up separate alarms for 10, 9, 8, 7 pm etc & check each time. The earliest one should overwrite the others.
If your theory is correct, you won't see any entries until you get to something like 10am.
Sorry, when I set the alarm at 23:20, I disabled the 20:20 alarm, so the 23:20 alarm is the next one and didn't get detected.
Anycase, the 23:20 alarm was detected and also the 7:45 alarm... but it was not detected in my automation at 3am. When I woke up at 7:30 or so, the 7:45 alarm was detected, maybe becouse i started HA App but Im not sure.
Now (its 8:25 here), next alarm sensor is still at 7:45.
I have set the following alarms, in this order:
10:30 -> next sensor is still at 7:45
10:00 -> next sensor is still at 7:45
9:30 -> next sensor is still at 7:45
9:00 -> next sensor is still at 7:45
8:30 -> next sensor is at 8:30!
I will keep an eye on the sensor to see if it gets uptaded.
Updates:
When the 8:30 alarm triggered, I posponed it and next_alarm inmediatly updated to 8:40. OK. I have created an automation to notify when next alarm is updated.
When the 8:40 alarm triggered, I stopped it and next_alarm was not updated to 9:00 alarm, it is still at 8:40. FAIL
9:00 alarm triggered, I waited some seconds and posponed it. The automation triggered twice: the first notified that next alarm was set to 9:30, the second notification informed that next alarm was set to 9:10. OK
9:10 alarm triggered, cancelled it and... next alarm is updated to 9:30. OK
9:30 alarm triggered, cancelled it and... next alarm is updated to 10:30. That's fine becouse the 10:00 alarm was only set from monday to thursday. OK
I modified the 10:00 alarm to trigger algo today (friday) and the next alarm was correctly updated. OK
10:00 alarm triggered, cancelled it and next alarm is updated to 10:30 OK. I have also created alarms at 12:00 15:00, 20:00, 23:59 and 8:00
10:30 alarm triggered, cancelled it and next alarm is updated to 12:00 OK.
12:00 alarm triggered, canceled it and next alarm is updated to 15:00 OK.
15:00 alarm triggered, cancelled it and next alarm is updated to 20:00 OK. I have tried disabling the 20:00 alarm but it does not update the next alarm to 23:59, it keeps the 20:00 alarm even though it is disabled.
20:00 alarm triggered, cancelled it and the next alarm is NOT updated, it stays at 20:00. FAIL
At 22h approx the next sensor updated to 23:59. Again, if I disable the 23:59 alarm, the next sensor does not update to 8:00. I keep it disabled to see if the next update sensor will update later to 8:00
Changed the 8:00 alarm to 9:00 alarm. Next alarm sensor got updated at 7am.
So, I don't see a clear pattern. Sometimes it gets updated instantly, but sometimes it doesn't or doesn't get updated d at all.