Skip to content

Notifications

moralmunky edited this page Feb 24, 2021 · 4 revisions

Notifications can provide the information for the text summary example and also include the generated USPS Informed Delivery mail image.

Home Assistant integrates with several services that allow you to send notification. Please see the documentation for the service you are using for specifics on how to set up a notication.

Whether you need an internet accessible GIF or a camera entity will depend on the notification service you choose.

Requires an internet accessible GIF

  - 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.my_phone
        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