Notification command for ring/alarm to find lost phone

I lose my phone a lot, often right under my nose. I used to use the Absolutely Proprietary FindMyPhone on Android, but now that I have degoogled, I often have to ask someone to call me to find it.

What I really need is to remotely trigger the phone to ring/alarm. According to the docs, I can create an Activity Notification Command that will trigger any intent of any android app. The example on that page opens google maps navigation to Arby’s:

- action: notify.mobile_app_<your_device_id_here>
  data:
    message: "command_activity"
    data:
      intent_package_name: "com.google.android.apps.maps"
      intent_action: "android.intent.action.VIEW"
      intent_uri: "google.navigation:q=arbys"

Does anyone have (or know how to get) the intent data for an alarm or phone ring?

There are other notification commands that can enable the screen/flashlight/volume/location. These would all be useful in conjunction with the audible alarm going off. In this thread, I hope to create a config snippet for the general task of finding a lost phone. I’m just stuck on step one.

A bit kludgy but it might work. Just need to set the alarm time to datetime.now() using some kind of jinja. I will post a config if I get this working.

One thing that might keep it from working is the seconds. If current time is 10:18:15 and the alarm is set for 10:18:00, it will be missed. If I set it to 10:19:00, I have to wait 45 seconds before it starts ringing. I don’t think android alarms have seconds resolution so I don’t think I can set an intent to alarm at 10:18:16.

A better solution might be an intent to set a timer for 1 second, since I know android timers have seconds.

Oh! I searched for “timer” and found Starting an Alarm or Timer on an Android Phone:

Timer will trigger one second after the command:

service: notify.mobile_app
data:
  message: command_activity
  data:
    intent_action: android.intent.action.SET_TIMER
    intent_extras: android.intent.extra.alarm.LENGTH:1,android.intent.extra.alarm.SKIP_UI:true

Or make another phone call your phone.

Yeah, but if I call myself, I will get a busy signal.

make another phone call you

This is the automation I made. It flashes the flashlight for 60 seconds, maximizes volume, turns on the ringer, sends a location update, maximizes screen brightness, and turns on the screen. Also sets a one-second-timer as above.

This is working for me except that the timer alert is supposed to turn off after 60 seconds using android.intent.action.DISMISS_TIMER, but I couldn’t get it to work. So, if I don’t find my phone, it will keep making noise until the battery dies. If somebody can fix this, please reply.

To use this automation, create a button (settings > Devices & Services > Helpers tab > Create helper > “button”). I called mine “Find phone” so if you name it something else, change the entity_id below. Also change all the actions from notify.mobile_app_myphone to the correct name of your phone.

alias: Find my phone
description: ""
triggers:
  - trigger: state
    entity_id: input_button.find_phone
actions:
  - parallel:
      - action: notify.mobile_app_myphone
        data:
          message: command_volume_level
          data:
            media_stream: alarm_stream
            command: 100
      - action: notify.mobile_app_myphone
        data:
          message: request_location_update
      - action: notify.mobile_app_myphone
        data:
          message: command_ringer_mode
          data:
            command: normal
      - action: notify.mobile_app_myphone
        data:
          message: command_screen_brightness_level
          data:
            command: 100
      - action: notify.mobile_app_myphone
        data:
          message: command_screen_on
          data:
            command: keep_screen_on
      - repeat:
          count: 30
          sequence:
            - action: notify.mobile_app_myphone
              data:
                message: command_flashlight
                data:
                  command: turn_on
            - delay:
                hours: 0
                minutes: 0
                seconds: 1
                milliseconds: 0
            - action: notify.mobile_app_myphone
              data:
                message: command_flashlight
                data:
                  command: turn_off
            - delay:
                hours: 0
                minutes: 0
                seconds: 1
                milliseconds: 0
      - action: notify.mobile_app_myphone
        data:
          message: command_activity
          data:
            intent_action: android.intent.action.SET_TIMER
            intent_extras: android.intent.extra.alarm.LENGTH:1,android.intent.extra.alarm.SKIP_UI:true
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - action: notify.mobile_app_myphone
    data:
      message: command_activity
      data:
        intent_action: android.intent.action.DISMISS_TIMER
        intent_extras: android.intent.extra.alarm.SKIP_UI:true
mode: single
2 Likes