This is a modified version of @HowlingCoder’s Voice PE - Find your Phone blueprint. As I noted in that thread, I experienced some issues with the looping aspect of the original.
At this point I’m not sure why some users experience this issue while other users do not, but hopefully this is helpful to someone.
blueprint:
name: "Voice - Find My Phone - Modified"
description: Use voice commands to make your phone play TTS repeatedly until dismissed
author: Didgeridrew
domain: automation
input:
voice_commands:
name: Voice Commands
description: Command to activate
default: find my phone
selector:
text: {}
target_device:
name: Target Phone/Device
description: Select the phone/ tablet to find
selector:
device:
integration: mobile_app
multiple: false
tts_message:
name: TTS Message
description: Message to speak repeatedly on the phone
default: I am here! Your phone is right here!
selector:
text: {}
repeat_interval:
name: Repeat Interval
description: Seconds between TTS repetitions
default: 2
selector:
number:
min: 2.0
max: 12.0
step: 1.0
mode: slider
max_duration:
name: Maximum Duration
description: Maximum time to search in minutes (safety timeout)
default: 5
selector:
number:
min: 1.0
max: 15.0
step: 1.0
mode: slider
trigger_variables:
device_id: !input target_device
action_id: DISMISS_PHONE_FINDER_{{device_id}}
trigger:
- id: voice
platform: conversation
command: !input voice_commands
- id: found
event_type: mobile_app_notification_action
event_data:
action: "{{action_id}}"
trigger: event
variables:
message: !input tts_message
interval: !input repeat_interval
max_time: !input max_duration
notify_service: |
{{ 'notify.mobile_app_' ~ device_attr(device_id, 'name')|slugify }}
action:
- choose:
- conditions:
- condition: trigger
id: found
sequence:
- action: "{{ notify_service }}"
data:
message: command_stop_tts
data:
tag: phone_finder
- delay:
milliseconds: 200
- action: "{{ notify_service }}"
data:
message: clear_notification
data:
tag: phone_finder
channel: Phone Finder
- stop: Phone found
- conditions:
- condition: trigger
id: voice
sequence:
- repeat:
count: "{{ (max_time * 60 / interval) | int(10) }}"
sequence:
- action: "{{ notify_service }}"
data:
title: 📱 Phone Finder
message: Finding your phone... Tap to dismiss
data:
tag: phone_finder
persistent: true
importance: max
channel: Phone Finder
ttl: 0
priority: high
actions:
- action: "{{action_id}}"
title: Found It!
- delay: "{{ 3 if repeat.first else 2 }}"
- action: "{{ notify_service }}"
data:
message: TTS
data:
ttl: 0
priority: high
media_stream: alarm_stream
tts_text: "{{ message }}"
- delay: "{{ [interval - 2, 2] | max }}"
- condition: template
value_template: "{{ repeat.last }}"
- data:
message: clear_notification
data:
tag: phone_finder
action: "{{ notify_service }}"
- delay:
milliseconds: 200
- data:
title: 📱 Phone Finder Timeout
message: "Phone finder stopped after {{ max_time }} minutes"
data:
tag: phone_timeout
timeout: 10
action: "{{ notify_service }}"
mode: restart
max_exceeded: silent