core: Apprise integration fails to set up multiple services

The problem

Upon updating to 2024.2 the Apprise notification service fails to set up multiple services. I normally have 12 services created at startup but it now only creates 1 service, seemingly at random (all pushover URLs) (Ironically this was the very problem that used to occur with the native pushover integration which caused me to start using apprise instead)

This worked fine with the previous version (I guess it was 2023.12.something?) and the issue was immediately noticeable upon updating as I received my shutdown notification but did not receive my startup notification

I noticed the docs say there is only 1 active apprise user 😂 maybe I need to go back to the native pushover integration (assuming that now allows multiple services?)

Let me know if I missed anything useful

Cheers James

What version of Home Assistant Core has the issue?

core-2024.2.1

What was the last working version of Home Assistant Core?

core-2023.12.?

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Apprise

Link to integration documentation on our website

https://www.home-assistant.io/integrations/apprise

Diagnostics information

No response

Example YAML snippet

notify:
- name: 'pushover_apprise_1'
  platform: apprise
  url: pover://abcdefg@stuvwxyz

- name: 'pushover_apprise_2'
  platform: apprise
  url: pover://bcdefga@ztuvwxys

Anything in the logs that might be useful for us?

Logger: apprise
Source: components/apprise/notify.py:55
First occurred: 07:19:06 (11 occurrences)
Last logged: 07:19:06

Unparseable URL pover://g...i@a...v
Unparseable URL pover://g...i@a...a
Unparseable URL pover://g...i@a...w
Unparseable URL pover://g...i@a...t
Unparseable URL pover://g...i@a...f

----------

Logger: homeassistant.components.apprise.notify
Source: components/apprise/notify.py:56
Integration: apprise (documentation, issues)
First occurred: 07:19:06 (11 occurrences)
Last logged: 07:19:06

Invalid Apprise URL(s) supplied

----------

Logger: homeassistant.components.notify
Source: components/notify/legacy.py:104
Integration: Notifications (documentation, issues)
First occurred: 07:19:07 (11 occurrences)
Last logged: 07:19:07

Failed to initialize notification service apprise

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

I’m sorry all 😔. I’ll investigate when i get home next week.

At this point I’ll need to start tracking down what else changed with Home Assistant in its recent releases. Hopefully it will be straight forward to adapt. 🙏

See PR attached to explain what was happening to you all. I added unit tests in Apprise as well to catch this kind of thing for the future as well.

The short of it is: It turns out to be a racing condition that was introduced in Apprise v1.7.0 where (notification) modules were only loaded on demand. As it turns out, I didn’t consider or test the case where there would be multiple asynchronous calls to it’s initialization. Hence for each notify Apprise instance you guys had declared tried to initialize Apprise uniquely in another thread.

The new (Apprise) release I’ll prepare is v1.7.3 which will include the above PR and fix this. Once that is done, a small PR to Home Assistant will be needed to bump the version; no more complicated then the past ones made (e.g. 1.7.2 , 1.6.0, etc)

for those who can’t wait: the (Apprise) master branch works great. If you’re programmer-savvy, you just need to update your HA environment to grab it:

# Grab latest (patched) Apprise from Source
pip3 install git+https://github.com/caronc/apprise.git --upgrade --force

Edit: Created Apprise v1.7.3 Release which should resolve the issue we’re seeing here once HA is updated to reference it 🤞

I’ll need to investigate, but there is a good chance it did🚀