Automation that creates an alarm on my android phone

This is how i did that.

First i set a variable for the hour and minute that i want to set the alarm named “hour1” and “min1”
as i want to set the alarm for one minute from now,
hour1= current hour ,“now().hour”
min1= current min +1 “now().minute+1”
then these are added to the extras as variables instead of a single number.

Obviously, this will fail if the script is triggered at, for example “08:59” because it will set the alarm for 08:60 which is not a real time.

Otherwise, this works great

alias: "Set next alarm "
sequence:
  - variables:
      hour1: "{{now().hour|int}}"
      min1: "{{now().minute+1|int}}"
    alias: Set time
  - service: notify. Mobile_PHONE_NAME
    data:
      message: command_activity
      data:
        intent_package_name: com.google.android.deskclock
        intent_action: android.intent.action.SET_ALARM
        intent_extras: >-
          android.intent.extra.alarm.HOUR:{{hour1|int}},android.intent.extra.alarm.MINUTES:{{min1|int}},android.intent.extra.alarm.MESSAGE:Home
          Assistant Alarm,android.intent.extra.alarm.SKIP_UI:true
mode: single
3 Likes