Notify Mobile Companion App Devices

I had this working and for whatever reason it has stopped working. It seems to hit the first step in the trace and just skip to the end. I am fine with providing more information, but this is what i see. What is going wrong? It says action has run successful…but no notification.






The script itself is too big to post on this forum. Let me know what you need to see based on the screenshots i can provide.

In the recent version I have made some fixes to determine the Home and Away part. Did you already tried downloading the latest version?

Could you select the Repeat part and then the Changed Variables
image

Because if your device_tracker -entity has the state home then as a result the notify_devices_away variables is empty, and then you will get the behaviour (the [])as you’re describing…

1 Like

Apologies for the dumb question, but can someone explain to me how using this script is better than using automations method?

In your automation you can simply call this service, making you live easier to maintain it. So in the end the service does the same thing, but you don’t have to go through the whole documentation.

My current counter is now on 56 automations that uses this service. If I would update the service, then I don’t have to redo all other 56 automations, since they all point to this single service.

Have a look at the examples that you can use in your automation: Useful examples

2 Likes

Thanks for the explanation, also wondering what’s the difference between this script and this one?

I recently discovered this blueprint and would love to put this to use.

After an assortment of tests, I think I’m seeing a bug that prevents messages from being sent. It is coming up with the wrong notify.[device name]. The notify.[device name] may have been a valid entry in the past - but it is not now.

I have removed the blueprint, redownloaded, performed restart… it’s just not working. If I send a notification without the blueprint - those work.

I have tried the blueprint function with “both” and “home” and the messages don’t go through. They do, however, say it’s looking for a service that doesn’t exist; this applies both to my phone and my wife’s phone.

Flip side: it does work for my WearOS watch. But that’s one of three devices I’d need to hit.

I nosed around some and found a way to view the effects of the script. I’ll add what I’ve learned here, since I didn’t see it in what I reviewed.

  1. I have this working on all three device.

  2. The script looks at the device_trackers and extrapolates the notify.mobile_app_[device name] and if it doesn’t match, the script doesn’t work. For my wife’s phone, the router had reserved the non-“_2”, so her device_Tracker was [device]_2 and for mine, I had renamed the device to be more human-friendly. In both cases, this threw things off.

  3. I made sure that the device in mobile app and the device_tracker had the exact same name. Once that was done, success.

Awesome to see that you were able to find to issue and resolve it, and thanks for the feedback!

Currently there is no way to get the device services, so that is why I had to used the “find and replace” -part. But as you mentioned it did not work initially, so I’ll need to see if I can come up with some solution, since also others have noticed the same.

Is it possible to use this service with Node-RED?

I’m not using Node-RED, but it is just a “Script”, so I guess so?! Have you ran into issues? What is your experiences so far?

Just released a new version, check it out: Release 2024.04 · Grumblezz/Home-Assistant-Notify-Mobile-Companion-App-Devices (github.com) and updating should be super easy to update to the latest version with just two clicks:
image

Hello,

Thanks for this script which seems great, but which I couldn’t really try because I systematically get an error when sending the notification “Service notify.mobile_app_sm_a536b not found”.

For the record, “standard” notifications from HA work fine.

Here are some screenshots taken from the development tool :


version 2024.04

Thanks

This is a known issue, see Device not ending with _app breaking script · Issue #6 · Grumblezz/Home-Assistant-Notify-Mobile-Companion-App-Devices · GitHub and the short answer is that you have to have to follow these instructions from the FAQ of HA Companion App: Troubleshooting | Home Assistant Companion Docs
And this one:
Troubleshooting | Home Assistant Companion Docs

So I may be a total idiot, I can’t figure how this blueprint work.

  1. I have installed the newest version of the Blueprint without any issues.
  2. I clicked “Create a Script” and immediately save it with a new name.
  3. The newly created script shows up in the “Script” section next to the blueprints
  4. I go to “Services” and can bring up the script just created.
  5. I can fill all the necessary information and click “Call Service” and everything works as it should.

But how can the resulting yaml from the Services tab be saved in the script.yamil file?
If I click on the script name in the Scripts section and switch to YAML mode, I see the following as an example:

alias: Notify of Power Failure
use_blueprint:
  path: Grumblezz/notify_devices.yaml
  input: {}
description: Sends Notification when the Power Has been Restored

If I try to copy the yaml code from the services tab in the script itself, I get an error:
stating: "Message malformed: extra keys not allowed @ data[‘service’]

So long way around to ask, how can I store my information in the scripts.yaml file.

For reference here is the full copy/paste that I am trying to save in the scripts file:

alias: Notify of Power Failure
use_blueprint:
  path: Grumblezz/notify_devices.yaml
  input: {}
description: Sends Notification when the Power Has been Restored
service: script.notify_of_power_failure
data:
  notify_devices:
    - 4e6e3...[my device number]
  notify_home_or_away: Both
  notify_title: POWER RESTORED
  notify_message: The Power has been Restored at Home!
  data_importance: high
  data_device_ring: Max
  data_critical: true
  data_ios_sound: alarm.caf
  data_ios_sound_volumelevel: 0.8
  data_ios_interruption_level: time-sensitive

Would be great to have an option: away if no one home

Once you imported the blueprint then you will have an entry like: script.the_name_of_imported_blue_print. The in the automation you just call the script like you would do when turning an light blub on/off.


and now you can fill in all these values to fit your automation:

I have an idea what that could mean, but I think it would be to confusing, as what counts as if no one home? Only the devices that can be notified? Or zone.home = 0 ( {{is_state('zone.home',0)}} )? What if I want to exclude something/device/person…? It would become quite an rabbithole in the ‘simple’ automation. What I have done so far is to solve this using the automation with a Choose option

I see your point. But what I mean is (hopefully) much easier.
Currently you implemented already three “device states”: home, away, both.

My idea is just to mix “home” and “away”. Similar to “both” but a litte bit different. So if if none of the device state is “home” than all devices with state “away” would be notified.
No new business logic :slight_smile: Just another version of “both”.

With this additional option you can easily setup something like e.g. notify device which are home that someone needs to take out the trash but if no device is home than every device away will be notified.

Thanks @Grumblezz
This seems to work for me, I am not sue why I really didn’t get how to implement this blueprint in the first palce. :). I appreciate you taking the time to explain it.

1 Like