Automations based on next scheduled alarm (on Android device)

Thank you very much for sharing this app! Works great!

1 Like

Hi there, i had some struggle to make it work properly at the first time - after installation it stated that the next alarm is set to next day at 00:00 - but it wasnt :wink: I tried to install Google clock and set alarms there, still no change. I restarted my phone and while there were no alarms it showed that next alarm is set next day at 10:00 - it wasnt :wink: But it updated after i set a new alarm. Now the only struggle is that the alarm is set at 7:50 but the app shows it is set for 6:50 :confused: Timezone in Hass is set properly, app shows alarm an hour before it should fire :confused:

Hi! Thanks for the work on this app an integration!
I can get it working with my internal connection at home ising http://[ip]:8123
However, I don have wifi on all the time, so I would like to connect to the external url I use. It uses reverse proxy on IIS, on url https://home.[domain].com

When I use the external domain, I get an error [Connection failed - Trust anchor not found]
Is there a way to get it working using my external URL?

Hey!
I think this is due to an issue with your certificate. How is the certificate issued? There is a similar issue here: https://github.com/Johboh/hassalarm/issues/17

Hi, thanks for the reply.
I’m using a letsencryp certificate on that domain

Never mind, I see your respons a few posts up. Sorry.

Is there any possibility to get the name/description of the alarm from the phone?
Let’s say that on weekdays I want to wake up and just go to work, but on weekends I want coffee made.
So if I trigger on this alarm I need to know if it’s weekend or weekday alarm (simplified).

Obviously you could have a day off in the middle of the week and still have coffee and that is why it would be better to base it on the alarm name than weekday name.

Can you verify that the certification is working properly? I.e. when you navigate to your hass instance over https there is no certificate issues by your browser.

Hey!
No its not currently possible, you can see my answer in this post above: Automations based on next scheduled alarm (on Android device)
Basically the Android API does not expose that.

I have noticed that the app has started to report my calendar notifications as alarm events to Hass. Is there any way to fix this?

Hey!
This sounds very similar to the issue mentioned at the end of this issue: https://github.com/Johboh/hassalarm/issues/7
That your calendar app is reporting events as alarms (using the AlarmManager), which it shouldn’t. What device and calendar app are you using?

Thanks for the answer. I have an samsung galaxy s10 and I use google calendar and the built in calendar app. From the issues site it looks like it could be google calendar spooking I’ll try to disable it then.

Yes try disabling the built in app (and use the google calendar one). I use the google calendar one and that one does not interfere. It might also be that there are some settings you can change for the internal one to not publish alarms.

oh okay, thanks:-)

I use a input Boolean which I check if it’s off, if it is the automation runs and turns it on.

Another automation turns it off daily at 00:00

I’ve installed this app and it works great! Thanks for your time and effort on this.

I have a couple of questions though. Is there any way at all that this could work with the Lenovo smart clock? I don’t own one, but it would be amazing if this could trigger automations. The key here is triggering lighting before the alarm clock goes off in an automation.

It’s just a great form factor so would make an ideal clock interface.

Also, any way of getting the same functionality on iOS?

Hey!
This app uses the Android API for knowing the next alarm, as reported by the OS. Decent alarm clocks will use the AlarmManager API to report their alarms, and Android will report these accordingly.
For iOS, its possible, but someone needs the create that app :). And also investigate if there are some similar APIs available.
For Lenovo smart clock: This is a different kind of intergration as the alarm clock is not running on the Andorid phone itself, i.e. there is no reporting in the API. For this, Lenovo smart clock either must provide an API for accessing the next alarm (and someone needs to create an Home Assistant integration for this), or if its possible to extract the next alarm from Google Assistant, as it do integrate with Google Assistant. This is, however, out of scope for this app :).

Thanks for the clarification.

Another question!

Is there any way of making this bi-directional?

I have managed to integrate this with an alarm clock that I have built in nodered. Basically, if I set the alarm on my Android device, this updates an input_datetime for my alarm clock. What would be handy though, is if I changed the input_datetime manually in Lovelace/Home-Dashboard app, this change would then go back to the android device keeping everything in sync.

The image is of my current Alarm clock interface using the great Home-Dashboard app.

That is not possible with this app. For that, you either need a custom build alarm clock that you can control on your app, or an alarm clock with an open API where you can set alarm. It’s not supported via Android OS API.

Hi!

I’ve tested this and it’s working with my account & phone…

How can I manage my daugher account & phone so HA understands differences with those input_datetime.next.alarm?

I am plannig to use this for a wake-up lights with ikea leds.