Update notifications (Core, OS, Addons, HACS, etc)

@CentralCommand Thank you for this awsome blueprint, just picked up a bug or at lease I think it might be, I tried to update from my ios device, but the trigger event was not ‘install_ios’ but instead ‘install’ and then it failed setting the update entityId.

- variables:
    entity_id: &tag-to-entity >-
      update.{{ trigger.event.data.action_data.tag if trigger.id[-3:] == 'ios' else trigger.event.data.tag }}

Result is: update. instead of update.home_assistant_core_update

Trigger data:

trigger:
  id: install
  idx: '3'
  platform: event
  event:
    event_type: mobile_app_notification_action
    data:
      action: install-update
      action_data:
        tag: home_assistant_core_update
    origin: REMOTE
    time_fired: '2022-04-13T15:31:06.846515+00:00'
    context:
      id: SuperSecretIdHere
      parent_id: null
      user_id: SuperSecretIdHere
  description: event 'mobile_app_notification_action'

Hope you can Help, love this blueprint, will be replaceing 3 automations of mine, lol.

Oh, huh. So to my knowledge any time an action was clicked in ios which the action identifier came back in trigger.event.data.actionName. But in android it would come back in trigger.event.data.action. This was happening as recently as a week ago for me, I actually commented on an old discussion with all the inconsistencies I found between ios and android here and that was one of them.

But now today I’m testing and suddenly ios is stuffing the selected action in trigger.event.data.action as well. Which honestly is great, I’m glad there’s consistency in this. But leaves me a bit confused as to what happened. I don’t see a PR about this in the past week…

Anyway thanks for bringing it to my attention. I will fix it. I might leave the code in there to handle action or actionName since I’m still still a bit skeptical how this changed. But I’ll make sure it works for the event data ios appears to be returning now.

Thank you, sorry new to blueprints. Will I be notified if you update the blueprint or do I need to reimport it once you made changes?

The result:

update.home_assistant_operating_system_update
binary_sensor.home_assistant_operating_system_update_available
sensor.home_assistant_operating_system_version
sensor.home_assistant_operating_system_newest_version

:man_facepalming: right, I disabled all the other entities besides the update one there on my system. Obviously not everyone does that.

@DickSwart @erik7 updated with fixes for both of these issues, sorry about that.

Unfortunately no. There’s no notifications and you need to reimport after. It’s a bit frustrating I know, we had a bit of a discussion on it here. There’s an FR to improve this, please vote for it!

Upvoted and DUDE you the shit! thank you. Will test now and give feedback about my issue

1 Like

hey again @CentralCommand Mike

I was wondering if you are experiencing the same, or if what I am seeing is an isolated case, or maybe installation type dependant.

My Supervisor Update entity shows as Unavailable. And I don’t mean with a state of “Unavailable” (red colour in history) but a status of “Unavailable” (grey colour - like when a device is disconnected and the entities are unavailable). Here are some screenshots to compare - notice the red exclamation mark too


image
image
image

This was the case ever since upgrading. Running on the latest Supervisor version

Thanks in advance

@CentralCommand It’s working like a charm, thank you again.

I have not seen that myself but it looks like you’re hitting this issue. Fortunately this PR went in to fix it about 10 hours ago. Unfortunately that was too late for 2022.4.3 so I would look for a 2022.4.4 to fix it most likely. It doesn’t say so on the PR right now but my guess is that will get cherry-picked for the next patch.

Oh i checked for issues yesterday and nothing was raised, and now i was paranoid but didn’t check again. Thanks for the investigation.

Another suggestion Mike, not a deal breaker, just not great UX i feel.

The icon used for the notification package-up, i would personally suggest to either revert to default, the HA icon, or provide an icon picker field (not sure if it was made available in such use case) or an input field.

My reasoning behind this is that the user loses the app author that sent notifications, especially when in the top bar only. See some screenshots, alongside your old package for comparison.


Don’t get me wrong, i fully understand what you have tried to achieve, but i just feel it distances the notification from the authoring app. Maybe the user input is the best of all worlds, leaves the choice to thr user.

Hope this feedback helps

Makes sense, I can add that.

I find the icon change really handy personally since I usually have a bunch of HA notifications in my bar and can tell without expanding the bar whether its something I should look at immediately or not. That was actually my most missed feature when I switched from html5 notifications to the android companion app ones a long time ago. Well besides actions but I just refused to switch until those were added. So I guess you could say its my most missed feature that I was willing to live without :slight_smile:

It was only added (relatively) recently which is why it was missing from the update notifications package.

1 Like

@robertalexa added an option to change the status bar icon.

1 Like

You are an absolute gentleman!

LE: this whole thing motivated me to review and visually improve all my notifications - i kept saying i will do it, well, tonight was the night :smiley:

To give back, i’ve had a look into the 2nd desired Improvement, and i think i might have a solution. Though i have not tested it and today has been a long day. Happy to have a go at it tomorrow if you don’t make it work by then :smiley:

  1. Use an input for mobile_app_devices that supports multiple: true, like the entity one.
  2. Change your &send-to-mobile-devices sequence to a repeat along these lines (over simplified and not accounting for the Apple check):
- &send-to-mobile-devices
  repeat:
    # Get total number of devices in list and repeat that many times
    count: '{{ !input mobile_app_devices | count }}'
    sequence:
      # Get device in loop number - 1 (as arrays start at position 0)
      device_id: '{{ !input mobile_app_devices[repeat.index - 1] }}'
      domain: mobile_app
      type: notify
      title: "{{ title | default('') }}"

This might not be a plug and play answer, and again, forgive me for not testing something for you, but today’s day already melted my brain. I do however thing that this is on the right track, and should get what you want :slight_smile:

Hope this helps, at least slightly (from an inspiration perspective if not much else)

Rob

Unfortunately that won’t work. I tried it actually :slight_smile:

So first, a small note, you can’t use !input in a template like that. You have to stick it in a variable and then use the variable instead. Like this:

- variables:
    devices: !input mobile_app_devices
- repeat:
    count: '{{ devices | count }}'
    ...

But the real problem is the second part, the actual notify action, here:

device_id: '{{ devices[repeat.index - 1] }}'
domain: mobile_app
type: notify
title: "{{ title | default('') }}"
...

This won’t work because the device_id field does not accept templates. Give it a shot, just make a quick script. Try this below and you’ll see what happens (replace device_tracker.my_phone with whatever you call your phone’s device tracker):

- variables:
    id: "{{ device_id('device_tracker.my_phone') }}"
- device_id: '{{ id }}'
  domain: mobile_app
  type: notify
  title: Hi
  message: Hi

You get this:
Screen Shot 2022-04-13 at 7.08.00 PM

It doesn’t say it there but what’s actually happening is its trying to literally use the text {{ id }} as the ID. It’s not processing it as a template.

The other option I tried was just to provide a list of device IDs for device_id. That works for entity_id so seemed like you should be able to just do this for device_id:

- device_id: !input mobile_app_devices
  ...

Where mobile_app_devices has multiple: true. That doesn’t work either though, lists aren’t accepted.

That’s where I ran out of ideas. I looked around and it seemed like other blueprints are doing a fixed amount of mobile_device_# inputs so I did that too. But it definitely bugs me.

No Error anymore. Great work! :grinning:
Thanks a lot!

Hm… i see. Thanks for your well documented answer.

Am i right in assuming that the same sort of problems are to be expected if we change the notify sequence for a notify service call? e.g. service: notify.rob where the notify services are pre-defined in the config? And instead of the user choosing mobile app devices, they choose from a list of previously defined notification services?

In my case:
configuration.yaml

notify: !include includes/notify.yaml

notify.yaml

- name: rob
  platform: group
  services:
    - service: mobile_app_rob_s_phone
- name: steph
  platform: group
  services:
    - service: mobile_app_steph_s_phone
- name: both
  platform: group
  services:
    - service: mobile_app_rob_s_phone
    - service: mobile_app_steph_s_phone

Hey Mike,

When pressing the Update button for HA Core (the one presented above in the mobile screenshot), i get some errors in the HA log.

This line: Update Notifications Automation Blueprint · GitHub

That is… not how I thought default worked. Really thought it shortcircuited, apparently not. Just switched it up to use a proper if statement there, sorry about that.

1 Like