Automations based on next scheduled alarm (on Android device)

Thank you, I like the idea (though I believe it should also be doable with tasker?).

I installed your app (using an access token) on my Note 9. But it doesn’t seem to work? I can not see the sensor. But after clicking “save” it shows the correct Next Alarm in the App.

A “test connection” button with an error message would be a good idea.

Yeah, the app is quite naive when it comes to error handling and assumptions. I will add a “test connection” functionality and expose errors a bit better.

Thanks. Any idea on why it is not working? Where can I look?

No not really, it could be anything. But I will add that test connection feature today so you can diagnose.

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.

1 Like

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

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.

Hello,

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(1.3.0.2)

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!

Hello,

You can find an example here: http://ariela.surodev.com/2019/03/03/mqtt-next-device-alarm/
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 https://home-assistant.io/components/automation/

this is my code in automations.yaml so far:

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