Skip to content

Notifications

moralmunky edited this page Feb 24, 2021 · 4 revisions

Notification Automation

  - alias: "Mail Notif - Mail Delieveries GIF"
    initial_state: true
    trigger:
      #Trigger if mail or packages get updated
      - platform: state
        entity_id: sensor.mail_usps_mail
      - platform: state
        entity_id: sensor.mail_packages_in_transit
    #send only if mail or packages are more than 0
    condition:
      - condition: or
        conditions:
          - condition: template
            value_template: "{{ ((as_timestamp(now()) - as_timestamp(states.sensor.mail_usps_mail.last_changed)) < 15 and states('sensor.mail_usps_mail')|int > 0) }}"
          - condition: template
            value_template: "{{ ((as_timestamp(now()) - as_timestamp(states.sensor.mail_packages_in_transit.last_changed)) < 15 and states('sensor.mail_packages_in_transit')|int > 0) }}"
    action:
      - delay: "00:00:20"
      - service: >-
          notify.{{ states('input_select.notify_select') }}
        data:
          title: "Mail and Packages"
          message: "{{ states('sensor.mail_deliveries_message')}}"
          data:
            attachment:
              url: "{{ states('sensor.mail_image_url') }}"
              hide-thumbnail: false
            apns_headers:
              apns-collapse-id: "homeassistant-mail-update"
            push:
              thread-id: "homeassistant-mail"
              sound:
                name: US-EN-Alexa-Mail-Has-Arrived.wav
                critical: 1
                volume: 0.3
Clone this wiki locally