Home Assistant Guide

Simple tutorials for powerful automations

Set an Alarm on Your Android Phone from Home Assistant

This Home Assistant script allows you to set alarms remotely on your Android phone using the Home Assistant Companion App. It's ideal for automating wake-up routines, reminders, or alarms triggered by other smart home events.

What Does This Script Do?

This script sends a command via notification to your Android phone that sets an alarm instantly at your specified time. You can use this for:

  • Automatically setting your morning alarm
  • Scheduling alarms based on your calendar or events
  • Triggering alarms when specific conditions are met
  • Remote alarm adjustments without manually handling your phone

How to Add This Script to Home Assistant

  1. Copy the Script YAML below:
    
    alias: Set Alarm on Android Phone
    description: Set an alarm on a selected Android device via Home Assistant Companion App.
    fields:
      target_phone:
        name: Target Phone
        description: The phone to send the alarm to.
        required: true
        selector:
          device:
            integration: mobile_app
      alarm_time:
        name: Alarm Time
        description: Time for the alarm (HH:MM:SS)
        required: true
        selector:
          time: {}
    sequence:
      - variables:
          hour: "{{ alarm_time.split(':')[0] | int }}"
          minute: "{{ alarm_time.split(':')[1] | int }}"
      - data:
          message: command_activity
          data:
            ttl: 0
            priority: high
            intent_package_name: com.google.android.deskclock
            intent_action: android.intent.action.SET_ALARM
            intent_extras: >-
              android.intent.extra.alarm.HOUR:{{ hour }},android.intent.extra.alarm.MINUTES:{{ minute }},android.intent.extra.alarm.SKIP_UI:true
        action: notify.mobile_app_{{ device_attr(target_phone, 'name') | slugify }}
    mode: queued
    
    					     
  2. Add the Script in Home Assistant:
    Go to Settings > Automations & Scenes > Scripts. Click Create Script, switch to Edit YAML, paste the code above, then click Save.
  3. How to Use the Script:
    Call this script from automations or other scripts, specifying your phone and desired alarm time.
  4. Example Usage in Automation:
     - service: script.set_android_alarm data: target_phone: "Pixel 7 Pro" alarm_time: "07:30" 

Note: Ensure the Home Assistant Companion app is installed and notifications are enabled on your Android phone.

Use Cases & Ideas

  • Set your alarm automatically based on your schedule.
  • Create dynamic wake-up routines that adapt to daily changes.
  • Trigger alarms as reminders for tasks or events at home.
  • Conveniently manage alarms remotely from your dashboard.