How to only get alarms in next_alarm sensor

Hi.
I have just started to use the next_alarm sensor in the app, and didn’t understand why it did not behave as I expected. Now I have figured out why, but need some help to solve it.
My problem is that both my alarm clock and my calendar sets alarms. So when I check in HA when my next alarms is, I sometimes get the next calendar alarm. Which is not what I want. So I used the filter funtion to only include my alarm app package. Then I saw this behaviour:

  1. I set two alarms, at 07:00 and 09:00. HA correctly displays 07:00
  2. I disable that alarm, and expect to see 09:00. But HA remains at 07:00
    Thought this was strange, but when I read the info text I understand that the problem is that there is a calendar alarm at 08:00. So when I disable the 07:00 alarm, the next alarm is the calender alarm. This is filtered out, and no update is sent to HA. So HA still believes I will wake up at 07:00, even though there is no alarm then.

Has anybody solved how to only the get the alarms from the clock, when also having calendar alarms in the phone?

Regards
Magnus

You should consider performing a search in the forums and the documentation as this has been addressed many times.

The app offers an allow list for you to target which apps to get the alarm from. Unfortunately some manufacturers like Samsung and Xiaomi do not report reliable alarm times. If you really want this sensor to work best use an Allow List and make use of a good app like Google Clock or Sleep as Android.

Hi.
Sorry if I missed any posts, I have been reading in the forum and there I found these two solutions to my first problem:

  1. I switched from Samsungs clock to Google’s clock (com.google.android.deskclock) and that solved an issue with alarm time being a few minutes off
  2. I added package filter to only allow the above package, and that solved so that I don’t get the calendar alarm into HA

But I haven’t found anyone explaining how to get around my third issue. Being that (I’m guessing) the app get the next alarm and see that it is a calendar alarm, drops it because of my package filter, and doesn’t update the state sensor. And then my second alarm scheduled at 09:00 is ‘shadowed’ by the dropped calendar alarm, no update is sent to HA, and there I still see 07:00.

Regards,
Magnus

You will see the next alarm update once it is scheduled as the actual next alarm, per the docs.

The samsung calendar app is known to make use of the alarm manager API, google calendar does not. You will need to wait for the next alarm to be scheduled which in your case will show up after 8am. This is just how the API works and unfortunately how Samsung decides to make use of it.

Yep, I understand why it appears as it does.

Great, that was just the clue I was looking for. I am using Google calendar as my main app, but Samsungs calendar was apparently in the background messing things up. The alarms were scheduled by “com.android.providers.calendar” so missed that Samsung was the villain.
Actually failed to disable/remove the alarms from the samsung app, but after uninstalling the Samsung Calendar, I got rid of them and only the alarm clock alarm showup.

Thanks for your help.

Nvm, did not quite solve it after all

this is very descriptive :slight_smile: