Hello,
because the Next Alarm Sensor is using Androids AlarmManager it can only see the very next alarm. If the app that scheduled the next alarm is not on the allow list, this hides the next alarm of any app on the allow list that is scheduled after that. In that case I think it would be a good idea to set the state of the sensor to unavailable
instead of skipping the sensor update and possibly leaving behind a wrong sensor value.
Example: Let’s say I have two apps A (my alarm clock) and B (some other app, not a real “alarm” but still using Androids AlarmManager for scheduling), and I’m only interested in the alarms from A, so only A is on the allow list.
It’s currently before 07:00, A’s next alarm is set to 07:00, B’s next alarm is 08:00. HA correctly knows that the next alarm is at 07:00.
Now I change the A’s alarm from 07:00 to 10:00 (maybe I have a day off and want to sleep in), so Androids next alarm is 08:00, but B is not on the allow list, so HA doesn’t update the next alarm sensor and leaves it at 07:00. The next alarm from A that I’m actually interested in is hidden behind the alarm from B. Because the sensor was not updated my automation still triggers at 07:00 (and turns on the lights in the bedroom).
My current workaround would be to not use the allow list and add a condition on the next alarm sensor’s package attribute in my Automation but I think having the value set to unavailable
or unknown
would be a cleaner approach.