Automations based on next scheduled alarm (on Android device)

I pushed the test connection feature now, both to github and also Google Play Store. Should be available shortly.

I am getting:

“Unexpected char 0x0a at 14 in Authorization value: Bearer Daniel:
[real token]”

So I made an error making a copy of my auth token (over Telegram). Maybe don’t display it with “*” symbols when entering? (and don’t show it at all later…)

It works now :slight_smile:

This project is just plain awesome! This is exactly what I was looking for! Thank you for such a great app!

Ever considered of sharing the knowledge?)) There is an open-source android client for HA in development (also on github) which could really benefit from such functionality.


Sounds like a good Idea :blush:. I will look into it.

1 Like

I like this project, thanks.

For people running into problems, set the correct timezone in your Home Assistant configuration so the value_template in the condition evaluates correctly.


I know its a old thread, but now Ariela (Ariela - Home Assistant Android Client) supports sending next alarm info to Home Assistant. You can create automation based on that.

Hey, can you tell me where i can find the sensor?
I checked the docs but i dont see this sensor on my device, just bluetooth, battery, light and so on.

Please check if you have the latest version of Ariela(

Thanks, it was an outdated version.
But is it possible to send an event if the alarm is triggered?
I’m not a big fan of automations that need to run every minute. I think its a bit needless and stressfull for the server. Maybe not with one automation but sometimes there are more of these kind of automations

For the moment is not possible to send that event from Ariela, but i will investigate maybe i can add something like this

I’m not sure if the automation example is going to work as the docs say

Rendering templates with time ( now() ) is dangerous as updates only trigger templates in sensors based on entity state changes.

Which i understand now() will only be rendered once the alarm is set, and therefore the automation should never trigger

I suppose you make a automation that can parse the state of the next alarm sensor to be triggered at that exact time?

Has anyone managed to get this working with Ariela / MQTT? I am struggling with the automation setting, I already got MQTT sensor working and its state attribute is in the format “yyyy-mm-dd hh:mm:ss”. How do I integrate this information into an automation to turn on a light at this specific time?

Thanks in advance!


You can find an example here:
Please let me know if you made it work.

Hi Ionut,

thank you very much for your link. It seems there is an issue (maybe with formatting / indentation) with this example? I copied it and edited it the way I think is correct, but still get an error:

Invalid config for [automation]: [minutes] is an invalid option for [automation]. Check: automation->minutes. (See /config/configuration.yaml, line 18). Please check the docs at

this is my code in automations.yaml so far:

- alias: Turn on light_sz-01 before Android Alarm
    platform: time
    minutes: /1
    seconds: 0
      condition: template
      value_template: '{{ (((as_timestamp(now()) | int) + 5*60) | timestamp_custom("%Y-%m-%d %H:%M:00")) == states.sensor.wecker.state }}'
    service: homeassistant.turn_on
    entity_id: light.light_sz-01

maybe formatting is wrong?
Thank you!

I think I managed to get it to work by myself. platform: time should actually be platform: time_pattern.
For anyone who is also struggling, here is my code for the automation:

- alias: turn on bedlamp 5 minutes before android alarm
    platform: time_pattern
    minutes: /1
    seconds: 0
    - condition: template
      value_template: '{{ (((as_timestamp(now()) | int) + 5*60) | timestamp_custom("%Y-%m-%d %H:%M:00")) == states.sensor.android_alarm.state }}'
    service: homeassistant.turn_on
    entity_id: light.bedlamp

Does this work with HTTPS? I can’t seem to get the app to connect to my HA. Thanks! Awesome idea.

I am using a Samsung S9 and Ariela. The timestamp I get in HA from my alarm sensor is in format “2001-01-01T01:01+0100”.
I have tried to use the suggested format above, but can’t get HA to read it.

value_template: ‘{{ (((as_timestamp(now()) | int) + 1*60) | timestamp_custom("%Y-%m-%d %H:%M:00")) == states.sensor.galaxy_s9_alarm_sensor.state }}’

Any suggestions please?

It might not :). But I can look into it.

Then it looks like you get a different format than %Y-%m-%d %H:%M:00, as you also have the timezone embedded. Is the states.sensor.galaxy_s9_alarm_sensor.state not of format 2019-12-14 07:55:00 ?