Easily track all your package/parcel!

Hello, here’s a Frontend display for the integration. :slight_smile: It only works with versions above 0.1.2!

It can be quickly rewritten into other languages as it includes a translation option. I took the basics from the widely used Track17 markdown script and adapted it for ParcelsApp.

And below you can find a simple package removal tool.
The code is in English, only the example is in Hungarian :slight_smile:

{% set computer_text = '<ha-icon icon="mdi:laptop" style="color:yellow"></ha-icon>' %}

# **[ParcelsApp](https://parcelsapp.com/)**

{% set parcels = states.sensor | selectattr('entity_id', 'match', 'sensor.parcelsapp_tracking_*') | list %}
{% set parcels_by_status = parcels | groupby('attributes.status') %}

{% set status_translation = {
    'archive': 'Archived packages',
    'delivered': 'Delivered packages',
    'transit': 'Packages in transit',
    'arrived': 'Packages awaiting delivery',
    'pickup': 'Packages awaiting pickup',
    'pending': 'Pending'
} %}

{% for status_group in parcels_by_status %}
{% set status = status_group.grouper %}
{% set packages = status_group.list %}

## {{ status_translation.get(status, status) | capitalize }}

---

{% for package in packages %}
### <ha-icon icon="mdi:package-variant" style="color:yellow"></ha-icon> **{{ package.attributes.get('name', '') }}** [{{computer_text}}](https://parcelsapp.com/en/tracking/{{ package.attributes.get('tracking_id', '') }})

{%- if package.attributes.get('tracking_id') not in [None, 'undefined'] %}
> **Tracking number**: {{ package.attributes.tracking_id }}
{%- endif %}
{%- if package.attributes.get('message') not in [None, 'undefined'] %}
> **Status**: {{ package.attributes.message }}
{%- endif %}
{%- if package.attributes.get('carrier') not in [None, 'undefined'] %}
> **Carrier**: {{ package.attributes.carrier }}
{%- endif %}
{%- if package.attributes.get('location') not in [None, 'undefined'] %}
> **Location**: {{ package.attributes.location }}
{%- endif %}
{%- if package.attributes.get('origin') not in [None, 'undefined'] %}
> **Origin**: {{ package.attributes.origin }}
{%- endif %}
{%- if package.attributes.get('destination') not in [None, 'undefined'] %}
> **Destination**: {{ package.attributes.destination }}
{%- endif %}
{%- if package.attributes.get('days_in_transit') not in [None, 'undefined'] %}
> **Days in transit**: {{ package.attributes.days_in_transit }}
{%- endif %}
{%- if package.attributes.get('uuid') not in [None, 'undefined'] %}
> **UUID**: {{ package.attributes.uuid }}
{%- endif %}
{%- if package.attributes.get('uuid_timestamp') not in [None, 'undefined'] %}
> **UUID timestamp**: {{ package.attributes.uuid_timestamp }}
{%- endif %}
{%- if package.attributes.get('last_updated') not in [None, 'undefined'] %}
> **Last updated**: {{ relative_time(package.attributes.last_updated) }}
{%- endif %}

{% endfor %}

{% endfor %}

type: custom:auto-entities
card:
  type: entities
  title: Package Removal
  state_color: true
filter:
  include:
    - domain: sensor
      entity_id: sensor.parcelsapp_tracking_*
      options:
        type: custom:button-card
        name: |
          [[[ return entity.attributes.name ]]]
        icon: mdi:package-variant-closed
        tap_action:
          action: call-service
          service: parcelsapp.remove_package
          service_data:
            tracking_id: |
              [[[ return entity.attributes.tracking_id ]]]
          confirmation:
            text: Are you sure you want to delete this package?
        layout: icon_name
        styles:
          card:
            - padding: 10px
          grid:
            - grid-template-areas: i status
            - grid-template-columns: min-content auto
            - align-items: right
            - padding-top: 2px
            - font-size: 14px
          name:
            - grid-area: "n"
            - justify-self: start
          custom_fields:
            status:
              - grid-area: status
              - justify-self: end
              - padding-top: 2px
              - font-size: 10px
        custom_fields:
          status: |
            [[[ return entity.attributes.tracking_id ]]]

image

5 Likes