#17track headaches

1 messages · Page 1 of 1 (latest)

austere torrent
#

So the 17Track integration has had some... issues with documentation since 2025.5 deprecated some stuff, and has not been updated. I've been trying to follow the information in the PRs to update the docs, but I think I'm missing something.

I have tried putthing this in my configuration.yaml:

template:
   - trigger:
       - platform: state
         entity_id:
           - sensor.17track_in_transit
           - sensor.17track_delivered
     action:
       - service: seventeentrack.get_packages
         data:
           package_state:
             - in_transit
             - delivered
           config_entry_id: 01JZ784K02DJ1WB1FB4SXXXXXX
         response_variable: packages_var
     sensor:
       - name: packages_data
         unique_id: packages_data
         state: "{{ packages_var['packages'] | length }}"
         attributes:
           packages: "{{ packages_var['packages'] }}"

I have tried making a helper and an automation using the above information.

If I run

action: seventeentrack.get_packages
data:
  package_state:
    - in_transit
    - delivered
  config_entry_id: 01JZ784K02DJ1WB1FB4SXXXXXX
response_variable: packages_var

In Developer Tools -> Actions, I get the correct data.

But regardless of which method I try to use, I can't work out how to access packages_var in a markdown card to actually show the information.

Any idea what I'm doing wrong?

nocturne bough
austere torrent
#

Yes, there are issues, but I'm at the point where I am receiving the data I need. I'm now trying to work out how to store that information somewhere, and access it in a card.

austere torrent
#

I created an input_text helper called 17track_transit, and then created this automation:

alias: 17Track Update
description: ""
triggers:
  - trigger: time_pattern
    hours: "*"
    minutes: /15
conditions: []
actions:
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      config_entry_id: 01JZ784K02DJ1WB1FB4SQ6Q5G1
      package_state:
        - Delivered
        - In transit
    response_variable: package_var
  - action: input_text.set_value
    target:
      entity_id: input_text.17track_transit
    data:
      value: "{{package_var}}"
mode: single

but it's not saving the data in the input_text

nocturne bough
#

I had this working as an automation to fill in input_text and it ran 22 mins past the hour

description: SeventeenTrack (17track) info
triggers:
  - trigger: time_pattern
    minutes: "22"
conditions: []
actions:
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      package_state:
        - in_transit
      config_entry_id: <some id>
    response_variable: transit
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      package_state:
        - not_found
      config_entry_id: <some id>
    response_variable: notfound
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      package_state:
        - ready_to_be_picked_up
      config_entry_id: <some id>
    response_variable: outfordelivery
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      package_state:
        - delivered
      config_entry_id: <some id>
    response_variable: delivered```
#
    metadata: {}
    data:
      value: |
        {% if transit.packages|length > 0 %}
        <ha-icon icon="mdi:transit-connection-variant"></ha-icon> in transit
        {% for package in transit.packages %}
        - **{{ package.friendly_name }} ({{ package.tracking_number }}):** {{
        package.info_text }}
        {% endfor %}
        {% endif %}
        {% if outfordelivery.packages|length > 0 %}
        <ha-icon icon="mdi:truck-delivery"></ha-icon> out for delivery
        {% for package in outfordelivery.packages %}
        - **{{ package.friendly_name }} ({{ package.tracking_number }}):** {{
        package.info_text }}
        {% endfor %}
        {% endif %}
        {% if notfound.packages|length > 0 %}
        <ha-icon icon="mdi:alert"></ha-icon> not found
        {% for package in notfound.packages %}
        - **{{ package.friendly_name }} ({{ package.tracking_number }}):** {{
        package.info_text }}
        {% endfor %}
        {% endif %}
        {% if delivered.packages|length > 0 %}
        <ha-icon icon="mdi:package-variant-closed-check"></ha-icon> delivered
        {% for package in delivered.packages %}
        - **{{ package.friendly_name }} ({{ package.tracking_number }}):** {{
        package.info_text }}
        {% endfor %}
        {% endif %}
    target:
      entity_id: input_text.parcels17
mode: single
#

I do not know if "config_entry_id" should be obfuscated but better to be safe :)

austere torrent
#

@nocturne bough that's perfect, you're a star. Thank you!

gritty rune
#

how can I get this data to show in a markdown card? any help would be appreciated.

austere torrent
#

Literally just {{states('input_text.parcels17')}}

#

Doesn't get easier

#

Here's how:

  1. Create an input_text helper called parcels17
#

Settings -> Devices & Services -> Helpers

#
  1. Create the automation pasted by @nocturne bough
#

Settings -> Automations and Scenes -> Create Automation, switch to YAML mode

alias: Parcel Check
description: SeventeenTrack (17track) info
triggers:
  - trigger: time_pattern
    minutes: "22"
conditions: []
actions:
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      package_state:
        - in_transit
      config_entry_id: <some id>
    response_variable: transit
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      package_state:
        - not_found
      config_entry_id: <some id>
    response_variable: notfound
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      package_state:
        - ready_to_be_picked_up
      config_entry_id: <some id>
    response_variable: outfordelivery
  - action: seventeentrack.get_packages
    metadata: {}
    data:
      package_state:
        - delivered
      config_entry_id: <some id>
    response_variable: delivered
  - action: input_text.set_value
    metadata: {}
    data:
      value: |
        {% if transit.packages|length > 0 %}
        <ha-icon icon="mdi:transit-connection-variant"></ha-icon> in transit
        {% for package in transit.packages %}
        - **{{ package.friendly_name }} ({{ package.tracking_number }}):** {{
        package.info_text }}
        {% endfor %}
        {% endif %}
        {% if outfordelivery.packages|length > 0 %}
        <ha-icon icon="mdi:truck-delivery"></ha-icon> out for delivery
        {% for package in outfordelivery.packages %}
        - **{{ package.friendly_name }} ({{ package.tracking_number }}):** {{
        package.info_text }}
        {% endfor %}
        {% endif %}
        {% if notfound.packages|length > 0 %}
        <ha-icon icon="mdi:alert"></ha-icon> not found
        {% for package in notfound.packages %}
        - **{{ package.friendly_name }} ({{ package.tracking_number }}):** {{
        package.info_text }}
        {% endfor %}
        {% endif %}
        {% if delivered.packages|length > 0 %}
        <ha-icon icon="mdi:package-variant-closed-check"></ha-icon> delivered
        {% for package in delivered.packages %}
        - **{{ package.friendly_name }} ({{ package.tracking_number }}):** {{
        package.info_text }}
        {% endfor %}
        {% endif %}
    target:
      entity_id: input_text.parcels17
mode: single

and save the automation

#
  1. Open the automation in the visual editing mode, go to Then do, and open each section starting with 17TRACK (there are 4) and select the 17Track service from the drop-down list.
#
  1. Go to a dashboard, create or edit a markdown card, and paste in {{states('input_text.parcels17')}}
nocturne bough
#

That is what I called it; "parcels17". You can also name it something else but the script assumes you have created that input text it is filling in. I have it set to 22 minutes past the hour. @austere torrent has it set to every 15 minutes in his example. I also replaced my config entry id with "<some id>" and you will need to replace it with your id I think. I don't think it will fill in magically. I created my script from someone else who I've forgotten the source. I'm glad it has helped. That is what worked for me. Make it work for you.

gritty rune
#

Thanks guys.. will have a go at it. 👍🏻

austere torrent
gritty rune
#

Got it all working, thanx..