Gets emails from IMAP and parses out any tracking numbers. Goes well with the tracking-number-card for lovelace!
Supported Emails
- Adafruit
- Adam & Eve
- Amazon
- Amazon DE
- Ali Express
- Alibaba
- B&H Photo
- Bespoke Post
- Best Buy
- Canada Post
- Chewy
- Costway
- Cradlewise
- DHL
- Dollar Shave Club
- DSW
- eBay
- Etsy
- FedEx
- Gamestop
- Georgia Power
- Giri Designs
- Google Express
- Groupon
- Guitar Center
- Home Depot
- House of Noa
- Inovelli
- Litter Robot
- Loog Guitars
- Lowes
- Manta Sleep
- Mixbook
- Moen
- Monoprice
- Navimow
- NewEgg
- Nintendo
- Nuleaf
- Paypal
- Pledge Box
- Philips Hue
- Prusa
- Reolink
- Rockauto
- SmartWings
- SparkFun
- Steiff
- Stride Rite
- Sylvane
- Sony
- Swiss Post
- SwitchBot
- Target
- TCGplayer
- Thriftbooks
- Timeless
- The Smartest House
- Ubiquiti
- UPS
- USPS
- Walmart
- Wayfair
- Western Digital
- Wyze
- Zazzle
If you want support for tracking, forward me the email (ljmerza at gmail) and open an issue.
Install with HACS by searching for Tracking Numbers, or copy custom_components/tracking_numbers into your Home Assistant config/custom_components folder. Restart Home Assistant then go to Settings → Devices & services → Add integration and pick Tracking Numbers. You'll need the email address and password (an app password for Gmail and most others) plus the IMAP server and port. Add the integration again for each mailbox you want to scan. It needs Home Assistant 2025.2 or newer.
| Name | Type | Requirement | default Description |
|---|---|---|---|
| string | Required | email address | |
| password | string | Required | email password |
| imap_server | string | Optional | imap.gmail.com IMAP server address |
| imap_port | number | Optional | 993 IMAP port |
| folder | string | Optional | INBOX Which folder to pull emails from |
| ssl | boolean | Optional | true enable or disable SSL when using IMAP |
| days_old | number | Optional | 30 how many days of emails to retrieve |
| trackingmore_api_key | string | Optional | Enables live delivery status via TrackingMore. Leave blank to disable. |
| max_packages | number | Optional | 100 most packages to keep on the sensor (10-500) |
| scan_interval | number | Optional | 30 minutes between email scans (5-1440) |
After setup the Configure button on the integration has three pages. Saving one reloads the account when something changed.
| Page | Name | default Description |
|---|---|---|
| Scan settings | days_old | 30 how many days of emails to scan |
| Scan settings | folder | INBOX which folder to pull emails from |
| Scan settings | scan_interval | 30 minutes between email scans (5-1440) |
| Scan settings | max_packages | 100 most packages to keep on the sensor (10-500) |
| Live status provider | status_provider | None where live status comes from, None, TrackingMore or Carrier-direct |
| Live status provider | trackingmore_api_key | TrackingMore API key, only used by the TrackingMore provider |
| Carrier API credentials | usps_client_id, usps_client_secret | USPS consumer key and secret |
| Carrier API credentials | ups_client_id, ups_client_secret | UPS client ID and secret |
| Carrier API credentials | fedex_client_id, fedex_client_secret | FedEx API key and secret key |
| Carrier API credentials | dhl_api_key | DHL API key |
The IMAP server, port and SSL setting (saved as use_ssl, it's the ssl row above) are changed with Reconfigure and the password with reauthentication, see Changing the Password or Server.
By default the integration only extracts tracking numbers from email. You can optionally enrich packages
shipped by recognized carriers (USPS, UPS, FedEx, DHL) with live delivery status — status,
delivery_status, estimated_delivery, and status_updated attributes. Retailer order numbers (Amazon,
Chewy, etc.) are skipped. Configure it under Configure → Live status provider; with the provider set to
None (the default) behavior is unchanged.
Two providers are available:
- Carrier-direct (free): query each carrier's own free developer API. Set the provider to Carrier-direct and enter credentials under Configure → Carrier API credentials for whichever carriers you use (leave the rest blank). Each carrier needs a free developer account: USPS (OAuth key + secret), UPS (client ID + secret), FedEx (API key + secret), DHL (one API key). Zero cost; delivered packages aren't re-queried and calls are rate-limited per carrier.
- TrackingMore (paid credits): supply a TrackingMore API key. One credit per tracking number registered; each number is registered once and re-read for free afterward, with new registrations capped per cycle.
No setup needed: the integration also reads delivery dates out of the shipping emails themselves ("Arriving Thursday", "Estimated Delivery: Oct 14", "Expected Delivery by Tuesday, September 22", "Delivered today") and adds them to each package:
estimated_delivery(YYYY-MM-DD) — withestimated_delivery_sourceset toemail. When a live status provider also returns a date, the live date wins and the source becomescarrier.delivered_date(YYYY-MM-DD) — set when a "Delivered" email is seen.
Relative wording ("today", "Thursday", "in 1-3 days") is resolved against the email's send date in your Home Assistant timezone; for a date range the later end is used. When several emails mention the same package, the newest email's date wins. Vague windows like "within 7-10 business days" are ignored.
To check what the parsers extract from saved emails without running Home Assistant, put .eml files or
JSON fixtures in .data/ and run python3 scripts/run_parsers.py (see the script's docstring).
If you have a package that is not captured via email, call the tracking_numbers.add_manual_tracking_number service (or use the lovelace card's add button) to save it alongside your parsed deliveries. Provide the target sensor's entity_id, the tracking_number, and optionally a link, carrier, origin, or status string. Use tracking_numbers.remove_tracking_number to delete a manual entry or hide a tracking number that was parsed from email.
Email is scanned every 30 minutes unless you change scan_interval under Configure → Scan settings. Call tracking_numbers.refresh to check email right away, pass a sensor's entity_id to only refresh that account or leave it empty to refresh every account.
If you want your own schedule turn off Enable polling for updates in the entry's system options and call the action from an automation.
tracking_numbers.add_manual_tracking_number adds a tracking number by hand. Calling it again with the same number updates it and keeps anything you leave out.
| Parameter | Required | Description |
|---|---|---|
entity_id |
Yes | The Tracking Numbers sensor to add it to |
tracking_number |
Yes | The tracking number |
link |
No | Tracking URL the card opens, defaults to the carrier's tracking page (a Google search for a carrier it doesn't know) |
carrier |
No | Carrier name like UPS or USPS, defaults to Custom |
origin |
No | Retailer or sender shown on the card, defaults to Manual Entry |
status |
No | Status text to show |
tracking_numbers.remove_tracking_number deletes a tracking number you added by hand. If it was parsed from email it gets hidden instead so later scans skip it, adding it back by hand unhides it.
| Parameter | Required | Description |
|---|---|---|
entity_id |
Yes | The Tracking Numbers sensor it shows up on |
tracking_number |
Yes | The tracking number to remove or hide |
tracking_numbers.refresh scans email right away. If the scan fails the action fails with the error, and a rejected password also starts reauthentication.
| Parameter | Required | Description |
|---|---|---|
entity_id |
No | Only scan this sensor's account, every account is scanned when it's left out |
Each email account gets one device with one sensor, sensor.<email>_tracking_numbers. The state is how many packages were found and the packages attribute has the list the card reads from. Each package has a tracking_number, link, carrier and origin plus the status and delivery date attributes above when they're available. summary has the package counts by carrier (by_carrier) and by retailer (by_retailer), and last_update is when the last scan finished.
Every scan_interval minutes (30 by default) the scan logs into IMAP, pulls the last days_old days of email from the folder, runs every parser over it and then merges in your manual tracking numbers. If live status is turned on it's fetched in the same scan. Manual and hidden tracking numbers are saved to Home Assistant's storage so they survive restarts.
If the mailbox can't be reached the sensor goes unavailable until the next scan works, it doesn't wipe your packages.
Get a phone notification when a package shows up
triggers:
- trigger: state
entity_id: sensor.user_gmail_com_tracking_numbers
conditions:
- condition: template
value_template: "{{ trigger.to_state.state | int(0) > trigger.from_state.state | int(0) }}"
actions:
- action: notify.mobile_app_phone
data:
title: Package
message: "You have {{ trigger.to_state.state }} packages on the way"Add a package by hand
action: tracking_numbers.add_manual_tracking_number
data:
entity_id: sensor.user_gmail_com_tracking_numbers
tracking_number: 1Z9999999999999999
carrier: UPS
origin: Marketplace orderIf your email password changes or the app password gets revoked Home Assistant will ask you to reauthenticate, just enter the new password. To move to a different IMAP server, port or SSL setting use Reconfigure on the integration, it checks the new settings before saving them. Scan settings, the live status provider and carrier keys are all under Configure.
- Invalid authentication most providers need an app password instead of your normal one. Gmail, iCloud and Yahoo all have one under the account security settings.
- Carrier credentials rejected shows up under Repairs when USPS, UPS, FedEx or DHL turns down the keys you entered. Fix them under Configure → Carrier API credentials and it clears after the next successful lookup for that carrier. Clearing that carrier's keys or switching the live status provider clears it too.
- TrackingMore key rejected shows up under Repairs when TrackingMore turns down your API key, and no new tracking numbers get registered until it's fixed. Update the key under Configure → Live status provider and it clears after the next successful TrackingMore lookup. Clearing the key or switching the provider clears it too.
- A package is missing the parser for that store probably doesn't recognize the email yet. Forward it to me and open an issue.
- Download diagnostics from the integration page when opening an issue. Email addresses, passwords, API keys and tracking numbers are redacted.
- Only reads email over IMAP so it needs a mailbox that supports it, there's no Gmail API or Outlook Graph support.
- Packages only come from emails the parsers recognize, see the list at the top.
- Retailer order numbers (Amazon, Chewy and so on) don't get live status since they aren't carrier tracking numbers.
- There's no STARTTLS. With SSL turned off the connection, password included, isn't encrypted, so use port 993 with SSL on.
- Only a rejected password asks you to reauthenticate. If the server is down or busy the sensor goes unavailable and the next scan tries again.
Go to Settings → Devices & services → Tracking Numbers, open the three dots menu on the account and pick Delete. If you installed through HACS you can remove it there afterwards and restart Home Assistant.