Get wake up alarm from a phone?

Hi,

I was wondering if someone had managed already to retrieve data from phones, for example alarm clocks, and how. My goal would be to use people’s alarm clocks to trigger some events. E.G.: I wake up at 6 am, it would be nice to automatically trigger a smart plug to launch my coffee machine at that time so by the time i go downstairs, my coffee is already hot. Stuff like that.

If anyone has ideas about this, I’d love to read them.

Thank you. :slight_smile:

You don’t need a phone or an alarm clock for this, it is built in to home assistant

You’re right but I read this to be that the OP wanted his phone to be the trigger for something to happen in HA.

Which in the case of an alarm clock I can understand. It is easier to set my phone to a certain time to wake me than use my HA server.

And it fits in with the HA vision of home automation (small h and small a) being ‘invisible’.

2 Likes

Retrieving alarm clock data from an android phone is possible with the app Tasker and a plugin AutoAlarm both can be found in the Playstore. Once date is recieved by Tasker there are multiple ways to send it to Home-Assistant. Ben got a nice video of a way to do it here. https://www.youtube.com/watch?v=CvSYZnKS0es

2 Likes

OMG there is a tasker plugin for everything !

I used to use tasker to read the from field from whatsapp and texts when driving, years ago.
Now i use it to backup my phone at night, but this alarm function could be very useful indeed !

Wow, nice! Tasker is definitely a killer app. Thanks for the advice, I’ll give that a look soon! :slight_smile:

I use the “Automate” app from Llamalabs for this. Basically i let my phone send the alarm time to home assistant when i set or change the alarm. And then Homeassistant takes care of playing music and lighting up the room slowly until its time for wakeup. Similar to a wakeup light from philips.

1 Like

Can you elaborate on this, please?

Please see below a screenshot of the Automate flow. Taking the time of the alarm and sending it via http request to home assistant and hue bridge.

2 Likes

That looks cool - would you mind sharing one or more of the http requests as well?
I have created a few buttons/shortcuts on my Android phone with the ‘HTTP Shortcuts’ app, but I always struggled to get the syntax right :frowning:

Sure… so the target basically uses the Hassio API

http://192.168.0.53:8123/api/states/sensor.alarmtime?api_password=YOURAPIPASSWORD

The Request Method is

POST

The Request Content Type is

JSON

The Request Content can be tailored to your need. I for example used this one with a basic sensor that i called alarmtime:

{“state”: dateFormat(Wake, “HH:mm, yyyy-MM-dd”)}

Where “Wake” is the output variable of the Alarm Node inside the flow.

3 Likes

Thanks Marcus - I’ll give it a try!

I was excited to be presented a solution based on Automate since I already use it to send TTS to my devices from HASS. I tried this setup yesterday and it works flawlessly. :smiley: Thank you very much! :slight_smile:

Btw, I first tried to create the sensors with Template then update them via Automate, so I always have them on my dashboard even if my phones haven’t sent their data yet, but when I create the sensors first, Automate doesn’t seems to update their respective data. Weird. Am I missing something?

I recommend using the input_datetime. With this is it will also stay after Home Assistant restart :slight_smile:

I just love this community. Each time I struggle with something, someone comes with the perfect solution. Thank you so much! :slight_smile:

I just use a Google Calendar - fire the automation when every event [matching a search string] starts.

Could you please write a novice-friendly post about how to get this to work? This would be my next step in making my house more autonomous.

Thanks

Thanks for the idea with automate by llamalabs. I’m not great with coding and sort of just copy paste and fumble my way through.

With your example above would it be possible to use it to toggle an input Boolean switch? And what would the Jason code look like.

Basically I have an automation set up and I want it to flag to HA that I’m sleeping and to inhibit some of my other automations. I work shift work so am often sleeping during the day.

Also I notice at the end it’s has the API password but that is now being replaced with the new loving method is that correct? So this part will have be changed too?

Yes indeed.
I ran into this issue recently and found a fix for automate. You can find it here:

Yes you can control anything with this method. Input_Numbers, Booleans, etc.
Just change this:

[http://YOURIPORDUCKDNS:8123/api/states/sensor.alarmtime]

to the correct sensor, or boolean or whatever you want to control.