Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to use per url tags in config for home assistant use. #1269

Open
codeman256 opened this issue Jan 15, 2025 · 4 comments
Open

unable to use per url tags in config for home assistant use. #1269

codeman256 opened this issue Jan 15, 2025 · 4 comments
Labels

Comments

@codeman256
Copy link

📣 Notification Service(s) Impacted

all?

🐞 Describe the bug

unable to supply tag per URL in config if using Home Assistant to call config.
This doesn't work

urls:
  - tgram://...
    - tag: hassio

whearas this does work

tags: hassio
urls:
  - tgram://...

💡 Screenshots and Logs

2025-01-14 18:17:53.548 DEBUG (SyncWorker_1) [apprise] Apprise API POST URL: http://10.3.2.10:8002/notify/hassio (cert_verify=True)
2025-01-14 18:17:53.548 DEBUG (SyncWorker_1) [apprise] Apprise API Payload: {'title': 'Your Garage Door Friend', 'body': 'The garage door has been open for 10 minutes.', 'type': 'info', 'format': 'text'}
2025-01-14 18:17:53.563 WARNING (SyncWorker_1) [apprise] Failed to send Apprise API notification: error=424.
2025-01-14 18:17:53.564 DEBUG (SyncWorker_1) [apprise] Response Details:
b'{"error": "One or more notification could not be sent", "details": [["INFO", "2025-01-14 19:17:53,560", "Loaded 1 entries from memory://"]]}'

💻 Your System Details:

  • OS: apprise and HA in dockers on unraid.
  • Python Version: up to date versions.

🔮 Additional context
tried multiple different ways here and I narrowed the issue down to this per URL tag method that does not work.

@codeman256 codeman256 added the bug label Jan 15, 2025
@caronc
Copy link
Owner

caronc commented Jan 15, 2025

tags isn't a valid; see here. Use tag for global representation.

The second example you provided is valid. It's not that it isn't working, it's that you're associating a name/label to the URL. Then you're trying to make a call without leveraging the target Home Assistance variable to specifically access this URL.

The other way works because there is no tag associated and no tag reference in the call (it's a more simplified example).

Check out this blog i did a few years ago and see if it helps

@codeman256
Copy link
Author

oh yes sorry mistype there. I fixed and and still have the issue.

working with this apprise config:

urls:
  - tgram://...
    - tag: cody
  - tgram://...
    - tag: spouse
  - https://discord.com/api/webhooks/...

and running this action in HA.

action: notify.apprisenotify
data:
  message: The garage door has been open for 10 minutes.
  title: Your Garage Door Friend

= only the discord notification.
but when this is ran:

action: notify.apprisenotify
data:
  message: The garage door has been open for 10 minutes.
  title: Your Garage Door Friend
  target: cody

= no notifications and I get nothing in the logs

@caronc
Copy link
Owner

caronc commented Jan 18, 2025

I also use (and absolutely love) Home Assistant. I use it with Apprise too and very heavily rely on tags. Since it works for me, i want to see if we can pinpoint the differences in our setup. I may very well have a bug and it just isn't surfaced on my end.

So in my configuration directory (for me it's /etc/homeassistant/apprise.yaml I have a file that looks like this (privacy detils redacted of course):

urls:
  # Email notification to everyone
  - mailtos://credentials?name=HomeAssistant:
      tag: everyone
      to:
        - user1@example.com
        - user2@example.com

  # Email notification
  - mailtos://credentials?name=HomeAssistant:
      tag: alarm, email
      to: user1@example.com

  # Pushbullet notification
  - pbul://credentials:
      tag: alarm, pushbullet

Then of course in the configuration.yaml (for HASIO) i have:

notify:
  name: apprise
  platform: apprise
  config: /etc/homeassistant/apprise.yaml

Now an example of a working automation :

- alias: "Garage Door Open Apprise Test"
  initial_state: true

  trigger:
    - platform: state
      entity_id: binary_sensor.garage_door
      from: 'off'
      to: 'on'

  action:
  - service: notify.apprise
    data_template:
      target: pushbullet
      title: Garage Door
      message: >-
         'Garage Door Opened {{ now().strftime('%Y-%m-%d %H:%M:%S') }}'

I'd be curious what tweaks i need to accomodate to which your configuration does not work where it should, or if perhaps just re-over-looking your configuration you can spot the problem?

@codeman256
Copy link
Author

Yeah, very strange. my configs are equivelently the same but I'm using url: http://10.3.2.10:8002/notify/hassio instead of config: in the home assistant configuration.yaml.
I also turned on debug in the apprise docker and can see the request when I send the notification without the target: cody
but then when I send it with target: cody I don't see anything. So I know it's working just not with the target specified.

I even enabled debug on apprise in HA, can see the logs output when I send a notification without the target and then I do NOT see any logs in HA when I include the target for the notification.

I updated HA docker before testing today as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants