Template value to exclude http-login notification

as per title how do i create a template value that exclude http-login persistent notification from an automation?
i tried this but it does not work

alias: "persistent notification and repair notifyer "
description: ""
trigger:
  - platform: persistent_notification
    update_type:
      - added
    notification_id: ""
    id: notifica persistente
  - platform: event
    event_type: repairs_issue_registry_updated
    id: riparazione
condition:
  - condition: not
    conditions:
      - condition: template
        value_template: "{{ is_state_attr('notification_id', 'http-login',) }}"
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - notifica persistente
        sequence:
          - service: notify.mobile_app_t
            metadata: {}
            data:
              title: ATTENZIONE
              message: "è apparsa una notifica persistente "
          - service: notify.mobile_app_s
            metadata: {}
            data:
              title: ATTENZIONE
              message: "è apparsa una notifica persistente "
      - conditions:
          - condition: trigger
            id:
              - riparazione
        sequence:
          - service: notify.mobile_app_t
            metadata: {}
            data:
              title: ATTENZIONE
              message: è apparsa una riparazione
          - service: notify.mobile_app_s
            metadata: {}
            data:
              title: ATTENZIONE
              message: è apparsa una riparazione
mode: single

Seems there’s a , at the end without the value you want to test for. Maybe check templates in developer tools first. Also, notification_id is not a valid entity id. So this will not work. This is meant for testing attributes in entities.

I do not know what is in the notification you want to exclude. The docs here show what data is available, maybe check for things in the title (trigger.notification.message)?

If you want to test the notification id, and it should not be http-login, then it would be something like this:

value_template: "{{ trigger.notification.notification_id != 'http-login' }}"

And then you can remove the not condition above it.

Your solution works partially
Since i have the login attempt threshold set to one when a ban happened i used to receive two notifications one for the invalid login and one for the ban for too many attempts
Now i only receive one (I assume the second one) do you know how to get rid of that?

Not without knowing more what is in them. Maybe you should put all event information in the notification to see how you can recognise them better, or chack to see if the automation trace holds more information.

this gave me an idea that i think works (tested disabling and re enablig the conditions two times to be sure)

condition:
  - condition: template
    value_template: "{{ trigger.notification.title != 'Login attempt failed' }}"
  - condition: template
    value_template: "{{ trigger.notification.title != 'Banning IP address' }}"
1 Like