And this part can be automated also.
My spouse likes to do this also, so if she sets an alarm the next morning then an automation kicks in and sets 9 more alarms with a few minutes between them
I would say Drew’s method is a valid answer.
Sure a snooze will knock things out of balance, but then again, the snooze will be the last alarm therefor it’s still correct as I see it.
But I guess Tw needs to answer this.
In reality snoozing or another alarm immediately after the current one is dismissed will still have the same results. The app and HA are still unaware of any additional alarms set until the current alarm has gone off (thats what the delay is for, waiting for the sensor to update). Whether you snooze an alarm for 5 minutes or have another alarm set for 3 minutes. The app will just report the literal next alarm on schedule. I always tell users its best to think of things like a literal timeline where only one comes after another. The app only knows what is next in line.
Now if you are looking to actually determine if an alarm was snoozed or dismissed, Sleep as Android has custom events for that to let things get a little more granular.
Edit:
OK, got it. It turned out that Android clock was a few seconds ahead of actual time and by the time it get to the set hour in HA the sensor got updated to the next alarm set in the phone. Syncing clock on the phone solved the issue.
Then an input number for how long before the phone alarm I want the lights to turn on. This will also make the light fade in to 100% (or profile Energize) when the alarm goes off. You will have to change this to suit your conditions.
Hello, in principle the automation works, but the lamp also turns on if I change the alarm on my cell phone or deactivate it. Is this normal? Can I change this? As I understand it, it only checks whether the alarm changes, and if so, the action is carried out.
Thank you for the great solution, it really helped! I took another approach, but I think I got it so far, but unfortunately it does not trigger the alarm.
I used these two lines:
(the upper one in a template,
the bottom one only as reference)
Hello, in principle the automation works, but the lamp also turns on if I change the alarm on my cell phone or deactivate it. Is this normal?
No!
My automation is based on two automations, that I’ve merged into one, as I like having it in the same automation.
But I started out with two:
Automation 1 is responsible for updating the “input_datetime.alarm_clock_light_start”. And this will trigger everytime the time changes, and update accordingly.
Automation 2 triggers by the time “input_datetime.alarm_clock_light_start” and start turning on the lights.
I use the “choose” funtion to separate this in the merged automation.
If the automation is triggered by the “alarm_clock_light_start” (see that I’ve given it an id name “Light On”:
trigger:
- platform: time
at: input_datetime.alarm_clock_light_start
id: Light On
If so, I would verify that you can use a time template as a trigger in Home Assistant.
I have never done that, so I don’t know. And I feel it’s somewhat strange way of doing it…
Thank you for the reply!
So, my idea was to use no helper at all. If you use a calendar event as a trigger you can set an offset and that’s it. But for next_alarm there is no way doing so.
So I thought I use a helper which acts as a trigger but this also doesn’t work, as mentioned above.
It works now as described in this post but this feels like too many automations just for an alarm clock.
But hey, it works, so I focus on other things now and might come back to this later.
Thanks a million for this. Drove me up the wall to find out why automation didn’t work, turned out phone’s clock was 2 seconds ahead.
But this makes the usage of next_alarm unreliable, since even a tiny bit out of sync results in automation not triggering.
Is there a way to make the next_alarm update every minute on 30th second for example? That way even if clocks are a bit out of sync, the automations would still work.
Yup, that’s exactly why I suggest that it should be updated not immediately but with a small delay. Corner case here is a person has two alarms set 1 minute apart and their phone is over 30 seconds out of sync with the HA. But how many people really set alarms 1 minute apart while I imagine 1-5 seconds out of sync should not be that uncommon.
Funny. I never encountered this desync issue because my wakeup routine goes off 10 seconds before the alarm sensor data is deleted, so as to give the speaker time to wake up and begin streaming.
I need to get my S24.next_alarm sensor information this format:
I need only alarm clock alarms, not any other alarm (example calender etc). (Developers tools → States i founded next alarm sensor give “state attributes” Package: com.google.android.deskclock, when use alarm clock)
How i get only this alarm clock alarm easy format to use on node-red or HA own automations if that easier method.
Not understand what you mean. If i go that companion app settings, manage sensors and search Next alarm. There is no filter or settings, just i can decide is that sensor enabled or disabled?