Skip to content

Home Assistant Service Notification Support Added#1294

Open
caronc wants to merge 3 commits intomasterfrom
1235-hassio-notify-services
Open

Home Assistant Service Notification Support Added#1294
caronc wants to merge 3 commits intomasterfrom
1235-hassio-notify-services

Conversation

@caronc
Copy link
Copy Markdown
Owner

@caronc caronc commented Feb 21, 2025

Description:

Related issue (if applicable): #1235

Addition of the following accepted Home Assistant URLs (allowing direct service notifications - to those that support it):

  • {schema}://{host}/{accesstoken}/{target}
  • {schema}://{host}:{port}/{accesstoken}/{target}
  • {schema}://{user}@{host}/{accesstoken}/{target}
  • {schema}://{user}@{host}:{port}/{accesstoken}/{target}
  • {schema}://{user}:{password}@{host}/{accesstoken}/{target}
  • {schema}://{user}:{password}@{host}:{port}/{accesstoken}/{target}

A target follows the following set of logic:

  • service
    • default domain is always 'notify' if one isn't detected
  • service:target
  • service:target1,target2,target3
  • domain.service
  • domain.service:target
  • domain.service:target1,target2,target3
    • targets can be comma/space separated if more hten one

You can specify more then one target by just separating it with a / (slash) on the URL... i.e:

  • hassio://hostname/long.lived.token/my_subsystem/my_subsystem2:targetA

Checklist

  • Documentation ticket created (if applicable): apprise-docs/29
  • The change is tested and works locally.
  • No commented-out code in this PR.
  • No lint errors (use tox -e lint and optionally tox -e format).
  • Test coverage added or updated (use tox -e qa).

Testing

Anyone can help test as follows:

# Create a virtual environment
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch
pip install git+https://github.com/caronc/apprise.git@1235-hassio-notify-services

# If you have cloned the branch and have tox available to you:
tox -e apprise -- -t "Test Title" -b "Test Message" \
    'hassio://host/long-lived-token/notify.mobile_app'

@caronc caronc linked an issue Feb 21, 2025 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e415aa8) to head (0ec58d2).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1294   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          197       197           
  Lines        26067     26166   +99     
  Branches      4253      4279   +26     
=========================================
+ Hits         26067     26166   +99     
Files with missing lines Coverage Δ
apprise/plugins/home_assistant.py 100.00% <100.00%> (ø)
apprise/utils/parse.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@svenjochems
Copy link
Copy Markdown

svenjochems commented Apr 22, 2025

Hi,
I tried testing this branch but was unsuccessful.

Persistent notifications with the original url still works as expected.
Calling a different service fails with Bad Request - Unsupported Parameters., error=400, not sure if I am passing the service incorrectly.

root@7f43bf5a3b5e:/# apprise -vvv -t "Test Title" -b "Test Message" 'hassio://ha.lan/<token>/notify.mobile_app_gsm_sven'
2025-04-22 20:01:59,216 - DEBUG - Could not load translation path: /usr/local/lib/python3.13/site-packages/apprise/i18n/en
2025-04-22 20:01:59,801 - DEBUG - Notification Plugin 110(s) and 157 Schema(s) loaded in 0.5742s
2025-04-22 20:01:59,803 - DEBUG - Loaded HomeAssistant URL: hassio://ha.lan/x...x/notify.mobile_app_gsm_sven?batch=no&format=text&overflow=upstream
2025-04-22 20:01:59,804 - DEBUG - Home Assistant POST URL: http://ha.lan:8123/api/services/notify/mobile_app_gsm_sven (cert_verify=True)
2025-04-22 20:01:59,805 - DEBUG - Home Assistant Payload: {'title': 'Test Title', 'message': 'Test Message', 'notification_id': 'f07e49aa-920a-47a8-a4b0-63689d42056d'}
2025-04-22 20:01:59,824 - WARNING - Failed to send Home Assistant notification: Bad Request - Unsupported Parameters., error=400.
2025-04-22 20:01:59,824 - DEBUG - Response Details:
b'400: Bad Request'

Edit: I think the parameter notification_id may not be supported by other notification services.

@caronc
Copy link
Copy Markdown
Owner Author

caronc commented Jul 29, 2025

@svenjochems : very sorry for delay; is this still happening using the latest snapshot of this branch?

@caronc caronc force-pushed the 1235-hassio-notify-services branch from 4ecc90a to b6982dc Compare March 31, 2026 00:51
@caronc
Copy link
Copy Markdown
Owner Author

caronc commented Mar 31, 2026

Give it another try and let me know how it goes @svenjochems 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom notifications with Home Assistant

2 participants