Notify Mobile Companion App Devices

Have you tried pasting the GitHub url? Maybe Pi Hole or another service is blocking this action?

The file is hosted on GitHub, so not some random webserver or so… The links that I have used where generated via the Home Assistant (Create a link – My Home Assistant) Link generator. So all of it refers to services that should be generally be accessible

HI , TTS on iOS does not work? Any idea?

Well, turns out disabling IPv6 did the trick. No clue why that didn’t interfere with other blueprints, but that does not matter now, it’s solved. Found the solution here: Timeout error while importing blueprint - #6 by Mr-Beat

Good one! I had a similar issue yesterday as well. Thanks for the feedback

I seem to have the same issue. I will have a look at it

TTS appears an Andriod only thing…

In the docs it is also only mentioned for Andriod
Introduction | Home Assistant Companion Docs (home-assistant.io)

With Frigate blueprint TTS works in IOS…. so it seems an issue in the Skript ?!

Can you share that blueprint? Because I’m using the companion app features.

Sure….

When I look at there code they have the same limitations of the mobile app. So no, you can’t use TTS on iPhone. What their Blue print does, is that it make use of the build in sounds of iPhone/Homeassistant. This same thing can also be done in this blueprint. So please check this page: Sounds | Home Assistant Companion Docs and then use your custom sound file name in this script

So here are some examples

FYI: update the service name to what ever you have defined during the creation of the blueprint, mine is called script.notify_devices

Example 1
This will send an sound notification to all of the IOS devices which have the mobile app installed. By default the sound level is set to 50%

service: script.notify_devices
data:
  notify_message: There is somebody at the door!
  data_ios_sound: US-EN-Alexa-Motion-At-Front-Door.wav
  notify_home_or_away: Both
  notify_devices: >-
    {%set devices=namespace(id=[])%}
    {% for device in (expand(integration_entities('mobile_app'))|selectattr('domain','in','device_tracker')|map(attribute='entity_id')|list) %}
    {% if is_device_attr(device,'manufacturer','Apple')==true%}
    {%set devices.id=devices.id+[(device_id(device))]%}
    {%endif%}
    {%endfor%}
    {{devices.id}}

Example 2
This will send an sound notification to all of the IOS devices which have the mobile app installed. Volume MAX and a critical notification marker

service: script.notify_devices
data:
  notify_message: There is somebody at the door!
  data_ios_sound: US-EN-Alexa-Motion-At-Front-Door.wav
  notify_home_or_away: Both
  data_critical: true
  data_ios_sound_volumelevel: 1
  data_ios_interruption_level: critical
  data_ios_presentation_options:
    - alert
    - sound
  notify_devices: >-
    {%set devices=namespace(id=[])%}
    {% for device in (expand(integration_entities('mobile_app'))|selectattr('domain','in','device_tracker')|map(attribute='entity_id')|list) %}
    {% if is_device_attr(device,'manufacturer','Apple')==true%}
    {%set devices.id=devices.id+[(device_id(device))]%}
    {%endif%}
    {%endfor%}
    {{devices.id}}

1 Like

Just wanted to say thank you for this blueprint! I never digged in to the details of how to trigger notifications in the companion app, and thanks to your work, I don’t need to either. Great work! Very appreciated!

1 Like

Thanks for this!
I have been personally struggling with how to pass data into a script blueprint and eventually gave up. You have provided a roadmap for me.
I truly appreciate your contribution to the community!
Time for more BP’s!

1 Like

A new version has released Release 2023.06 · Grumblezz/Home-Assistant-Notify-Mobile-Companion-App-Devices (github.com) check it out!

1 Like

Hi,

Thanks for this.

I have another question, related to the source of truth.

Rencently I have this in the script options:

Response variable This service can return a response, if you want to use the response, enter the name of a variable the response will be saved in 

However I cannot find this variable if in the github repo
`response_variable``

Hi zaggash,

The group feature is not supported by this automation, but there are a few options:

  • Make a feature requests at Home Assistant to be able to create a group with device_tracker objects. Because this is currently not supported.
  • Do not use the group option to call this script, but instead use a template , to filter for the devices and pass it on to this script, like:
{% set ns_devices=namespace( device_id=[] ) %}
{% for e in (integration_entities("mobile_app")|select("search","device_tracker")|list) %}
{% set ns_devices.device_id=ns_devices.device_id+[device_id(e)] %}
{% endfor %}
{{ ns_devices.device_id }}

And then add additional select() options to the second line

Or…

{% set ns_devices=namespace( device_id=[] ) %}
{% for e in ['device_tracker.apple','device_tracker.android'] %}
{% set ns_devices.device_id=ns_devices.device_id+[device_id(e)] %}
{% endfor %}
{{ ns_devices.device_id }}

Secondly the TTL feature is already available in the script by enabling the Important Notification. That will set the TTL to 0.

What response feature are you referring to? Is there a website that has more details about this?

Or are you referring to the custom actions part of this script?

@Grumblezz
Thanks for the quick tips.

Regarding the feature, this is what I have in the script:

See the response variable

You allow mobile_app devices to be added and then look for device_tracker for location.

Would it be possible to search through a group of mobile_app_* service using the service name ?

Sorry if I misunderstand the complexity I didn’t work on the blueprint as much as you did