Track Your Packages in Home Assistant // Mail & Package Integration

Today we’re going to look at how to track packages and mail in Home Assistant. This quick and easy project will allow you to see the status of packages being shipped to your house.

I don’t show you how to set up your account for the major carriers like UPS, USPS, and FedEx. But I’ve got links below to a quick guide from the integrations author.

Links in Video

https://tsh.li/MailHA – Mail and Package Home Assistant

https://tsh.li/MailServices – List of Config for Mail Services

Dashboard Example

What the dashboard looks like

Code

  - title: Packages
    path: packages
    icon: mdi:package
    badges: []
    cards:
      - type: entities
        entities:
          - entity: sensor.mail_packages_delivered
          - entity: sensor.mail_packages_in_transit
          - entity: sensor.mail_updated
        title: Deliveries
        show_header_toggle: false
      - type: vertical-stack
        cards:
          - type: horizontal-stack
            cards:
              - type: custom:mushroom-template-card
                primary: USPS Mail
                secondary: '{{ states(''sensor.mail_usps_mail'') }} pc'
                icon: |-
                  {% if states('sensor.mail_usps_mail')|int > 0 %}
                  mdi:mailbox-open-up
                  {% else %}
                  mdi:mailbox
                  {% endif %}
                icon_color: black
              - type: custom:mushroom-template-card
                primary: USPS Packages
                secondary: >-
                  {{ states('sensor.mail_usps_packages') }} ➤ {{
                  states('sensor.mail_usps_delivering') }} ➤ {{
                  states('sensor.mail_usps_delivered') }}
                icon: mdi:package-variant-closed
                icon_color: |-
                  {% if states('sensor.mail_usps_delivered')|int > 0 %}
                  green
                  {% elif states('sensor.mail_usps_delivering')|int > 0 %}
                  blue
                  {% elif states('sensor.mail_usps_packages')|int > 0 %}
                  yellow
                  {% elif states('sensor.mail_usps_packages')|int == 0 %}
                  white
                  {% else %}
                  gray
                  {% endif %}
          - type: horizontal-stack
            cards:
              - type: custom:mushroom-template-card
                primary: UPS Packages
                secondary: >-
                  {{ states('sensor.mail_ups_packages') }} ➤ {{
                  states('sensor.mail_ups_delivering') }} ➤ {{
                  states('sensor.mail_ups_delivered') }}
                icon: mdi:alpha-u-box-outline
                icon_color: |-
                  {% if states('sensor.mail_ups_delivered')|int > 0 %}
                  green
                  {% elif states('sensor.mail_ups_delivering')|int > 0 %}
                  blue
                  {% elif states('sensor.mail_ups_packages')|int > 0 %}
                  yellow
                  {% elif states('sensor.mail_ups_packages')|int == 0 %}
                  white
                  {% else %}
                  gray
                  {% endif %}
              - type: custom:mushroom-template-card
                primary: Fedex Packages
                secondary: >-
                  {{ states('sensor.mail_fedex_packages') }} ➤ {{
                  states('sensor.mail_fedex_delivering') }} ➤ {{
                  states('sensor.mail_fedex_delivered') }}
                icon: mdi:alpha-f-box-outline
                icon_color: |-
                  {% if states('sensor.mail_fedex_delivered')|int > 0 %}
                  green
                  {% elif states('sensor.mail_fedex_delivering')|int > 0 %}
                  blue
                  {% elif states('sensor.mail_fedex_packages')|int > 0 %}
                  yellow
                  {% elif states('sensor.mail_fedex_packages')|int == 0 %}
                  gray
                  {% else %}
                  red
                  {% endif %}
          - type: horizontal-stack
            cards:
              - type: custom:mushroom-template-card
                primary: Amazon Packages
                secondary: >-
                  {{ states('sensor.mail_amazon_packages') }} ➤ {{
                  states('sensor.mail_amazon_packages_delivered') }}
                icon: mdi:alpha-a-box-outline
                icon_color: >-
                  {% if states('sensor.mail_amazon_packages_delivered')|int > 0
                  %}

                  green

                  {% elif states('sensor.mail_amazon_packages')|int > 0 %}

                  yellow

                  {% elif states('sensor.mail_amazon_packages')|int == 0 %}

                  gray

                  {% else %}

                  red

                  {% endif %}
      - type: picture-entity
        entity: camera.mail_amazon_delivery_camera
      - type: picture-entity
        entity: camera.mail_usps_camera

Notification Automation

alias: Notification - FedEx Package Notification
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.mail_fedex_delivered
    above: "0"
condition: []
action:
  - condition: numeric_state
    entity_id: sensor.mail_fedex_delivered
    above: "0"
  - service: notify.telegram
    data:
      title: Fedex Delivery
      message: >-

        Looks like Fedex delivered your package. {{
        states.sensor.mail_fedex_delivered.state }} / {{
        states.sensor.mail_fedex_packages.state }} packages delivered.
  - condition: numeric_state
    entity_id: sensor.mail_fedex_delivered
    above: "0"
mode: single

Leave a Reply

Your email address will not be published.