# Use Homey to set or delete an alarm on Android and start a flow when the alarm rings

**URL:** <https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378>\
**Category:** Questions & Help\
**Created:** [May 13, 2021, 5:43pm UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378 "2021-05-13T17:43:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leone](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/leone/32/21264_2.png) [@Leone](https://community.homey.app/u/Leone)\
**Post date:** [May 13, 2021, 5:43pm UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/1 "2021-05-13T17:43:14Z")

</div>

Hi everybody,

Can someone put me in the right direction?

I have a logic variabele with a day ‘monday’ and one with a time ‘12:00’. I want a flow to start when it is currently that time and day.

Another way to achieve what I want is to make a flow to set an alarm in Homey when those logic variables are set or changed.

Soms background information:

I use Tasker with AutoAlarm to check for my next Android native clock alarm, and then sent the time and day of that alarm to Homey via a webhook and put it in a logic variabele.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Jero](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jero/32/17556_2.png) [@Jero](https://community.homey.app/u/Jero)\
**Post date:** [May 13, 2021, 8:47pm UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/2 "2021-05-13T20:47:56Z")

</div>

If you are willing to install HomeyScript you could do something like this:

```
// for testing purposes
if (args == null || args.length === 0) {
  args = ['thursday,13:00,13:00'];
}

const [day, time, currentTime] = args[0].split(',');
const card = await Homey.flow.getFlowCardCondition({
  uri: 'homey:manager:cron',
  id: 'day_equals',
})

const possibleValues = card.args[0].values;
const dayToCheckAgainstArg = possibleValues.find((value) => {
  return value.title.toLowerCase() === day.toLowerCase();
});

const { result } = await Homey.flow.runFlowCardCondition({
  uri: card.uri,
  id: card.id,
  args: {
    // id is daynumber, weekday or weekend 
    day: dayToCheckAgainstArg.id
  }
});

// is the day correct and are the timestamps equal
const returnValue = result && time === currentTime;
console.log(returnValue);
return returnValue;``

```

You just have to replace **thursday** and **22:43** with whatever is in the logic tokens you got from the webhooks. You also have to decide about the precision of the timers since this will only work with times divideable by 5 minutes. This also assumes your Homey is on English btw.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/0/e0ba48360a872fc1a6ee0dc26c24643930228141.png)

Did not really test this thoroughly but just an idea.

---

<div class="post-metadata">

**Author:** ![Joolee](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/joolee/32/3064_2.png) [@Joolee](https://community.homey.app/u/Joolee)\
**Post date:** [May 14, 2021, 9:30am UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/3 "2021-05-14T09:30:46Z")

</div>

It’s been a while since I last messed with Tasker, but isn’t it possible to calculate the seconds/minutes until next alarm and send that data to Homey? With that, you should be able to set a timer with Chronograph or similar app.

I can imagine you could do it all on the Homey with a few flows and using a lot of [MathJS](https://mathjs.org/docs/reference/functions.html) expressions. Or use Homeyscript to convert the day/time to ‘in x minutes’ format. It seems like a fun experiment.

---

<div class="post-metadata">

**Author:** ![Leone](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/leone/32/21264_2.png) [@Leone](https://community.homey.app/u/Leone)\
**Post date:** [May 17, 2021, 3:41am UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/4 "2021-05-17T03:41:08Z")

</div>

Thank you very much for your detailed reply! There are only two drawbacks to your proposal for me:

- The first is that I have no experience with HomeyScript.

- The second is that it seems very unnecessary to perform a check every 5 minutes. The flow should just start at the time that is already known.

---

<div class="post-metadata">

**Author:** ![Leone](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/leone/32/21264_2.png) [@Leone](https://community.homey.app/u/Leone)\
**Post date:** [May 17, 2021, 4:01am UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/5 "2021-05-17T04:01:40Z")

</div>

I got it done!

- If an alarm clock is set or adjusted in the standard clock app of an Android device, the time and day are also set in a Logic variable in Homey. Homey then shows me a notification to confirm my new alarm.

- When the alarm goes off, a flow will automaticly start in Homey.

- You can use flows to set a new alarm in your standard clock app or delete an existing one based on the time or the name of the alarm clock.

[![](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/2/e21f81ddbc728237738e010312590cd870f5c9e7.jpeg "HomeyAlarm") ](https://www.youtube.com/watch?v=C6waMRYYNt8)

What do you need to get this working?

- Tasker
- AutoTools (optional; to calculate the time your alarm will go off minus the given offset in minutes)
- AutoRemote (for communicating with Homey through webhooks)
- AutoAlarm (to retrieve your next alarm in your standard clock app)

You can import the Tasker project via the following link:  
[https://taskernet.com/shares/?user=AS35m8nRu3giFYRoZD%2FtlU%2FAiDGJ4EVpkHarD4YYCfgV6RGlYmqS18YfvC%2BhOmFLQsaG69lY%2BRg%3D&id=Project%3AHomeyAlarm](https://taskernet.com/shares/?user=AS35m8nRu3giFYRoZD%2FtlU%2FAiDGJ4EVpkHarD4YYCfgV6RGlYmqS18YfvC%2BhOmFLQsaG69lY%2BRg%3D&id=Project%3AHomeyAlarm)

All the needed flows:  
[https://homey.app/f/etGtUB/](https://homey.app/f/etGtUB/)  
[https://homey.app/f/b6LtUB/](https://homey.app/f/b6LtUB/)  
[https://homey.app/f/mhOtUB/](https://homey.app/f/mhOtUB/)  
[https://homey.app/f/wsRtUB/](https://homey.app/f/wsRtUB/)  
[https://homey.app/f/Y9TtUB/](https://homey.app/f/Y9TtUB/)  
[https://homey.app/f/gCVtUB/](https://homey.app/f/gCVtUB/)  
[https://homey.app/f/YOXtUB/](https://homey.app/f/YOXtUB/)  
[https://homey.app/f/gf\_tUB/](https://homey.app/f/gf_tUB/)

Example flows to test your setup:  
[https://homey.app/f/4N5uUB/](https://homey.app/f/4N5uUB/)  
[https://homey.app/f/-s8uUB/](https://homey.app/f/-s8uUB/)  
[https://homey.app/f/hVauUB/](https://homey.app/f/hVauUB/)

Logic Variables to add:

NextAlarmTime - Null  
NextAlarmDay - Null  
NewAlarmTime - Null  
NewAlarmName - Null  
DisableAlarmName - Null  
DisableAlarmTime - Null  
AutoRemotePassword - PASSWORD  
AutoRemoteKey - KEY

Feel free to ask questions if you need help getting this working!

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [May 17, 2021, 10:19am UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/6 "2021-05-17T10:19:59Z")

</div>

That sounds very good!  
Tasker is not the most intuitive app, so thank for this how-to.  
However, I do not see the forest because of the trees (as we say in Dutch 😉)…

I only need a way to automatically have a alarm (“wekker”) set in Homey when adding a new alarm or changing an existing one. Preferably only when it is labeled “WakeUp” (or something like that).  
What would I need then?  
Would I need a way to delete the alarm in Homey too, so there won’t be a whole list of alarma created there?

---

<div class="post-metadata">

**Author:** ![Leone](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/leone/32/21264_2.png) [@Leone](https://community.homey.app/u/Leone)\
**Post date:** [May 17, 2021, 10:33pm UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/8 "2021-05-17T22:33:04Z")

</div>

It is not possible to add new alarms in Homey itself using flows. You can only use the ones you allready configured yourself in the Homey app.

That’s why I use Tasker to detect when an alarm goes off on my phone and then start a flow that way.

I don’t use the build in alarm in Homey because of those limitations.

---

<div class="post-metadata">

**Author:** ![Rocky\_Lonigro](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocky_lonigro/32/80350_2.png) [@Rocky\_Lonigro](https://community.homey.app/u/Rocky_Lonigro)\
**Post date:** [September 9, 2024, 10:51pm UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/9 "2024-09-09T22:51:04Z")

</div>

did anything change here after 3 years?

---

<div class="post-metadata">

**Author:** ![Rocky\_Lonigro](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocky_lonigro/32/80350_2.png) [@Rocky\_Lonigro](https://community.homey.app/u/Rocky_Lonigro)\
**Post date:** [September 18, 2024, 3:40pm UTC](https://community.homey.app/t/use-homey-to-set-or-delete-an-alarm-on-android-and-start-a-flow-when-the-alarm-rings/47378/10 "2024-09-18T15:40:01Z")

</div>

does someone have this running atm and can help me get startet with tasker - what do I have to set in tasker first?
