Get wake up alarm from a phone?

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.

Hi, the best tip i can give is to use my above example and then replace it with different sensors or switches that you want to control. The JSON you can find out in the HomeAssistant Services Tab (the little remote in the bottom left corner).

Here you can find all the services (Which will also end up in the URL you are calling) and you can try out several different json configurations until you find exactly what works :slight_smile:

Thank you so much for the help

Too easy looks like automate has a seperate box for the request header then I would just put in the request content the Json code to toggle the Boolean switch.

This is going to open up so many possibilities for me now as I will have a simple and autonomous way for HA to know that I’m sleeping and not to switch on the lights and open the shutters if my partner’s alarm goes off haha.

Thanks again

Have you got an example to show me? I am planning to test the following when I get home. The message is the alarm time in plain text HH:MM (but can also be HH:MM:SS)

- alias: Set alarmtime_from_tasker
  trigger:
    platform: mqtt
    topic: "tasker/phone_alarm_time"
  action:
    service: input_date.set_value
    entity_id: input_datetime.wakeup_time
    data:
      time: '{{ trigger.payload}}'

Just use the example that i wrote further up.
I use this as JSON to Push the correct time:
{“state”: dateFormat(Wake, “HH:mm, yyyy-MM-dd”)}

The Format of course depends on the way you implement your alarm.

Can you share this flow for automate? Thanks.

still can’t get this to work i get a 401 error even though i’ve included the token. could it be because of 2 step authentication?

no matter works with automate just not http shortcuts app

Hi!
I tried out automate today and when I try to post {“Authorization”: “Bearer XXXXXXXXXX” } into the request header area I get: illegal character.:
Is it changed again?