Skip to content

feat: Add configurable filter_mode option (recent vs active)#76

Open
robbybarnes wants to merge 1 commit intojmdevita:mainfrom
robbybarnes:feature/configurable-filter-mode
Open

feat: Add configurable filter_mode option (recent vs active)#76
robbybarnes wants to merge 1 commit intojmdevita:mainfrom
robbybarnes:feature/configurable-filter-mode

Conversation

@robbybarnes
Copy link

Summary

Adds a user-configurable filter_mode option to control which parcels are fetched from the API.

Motivation

The ParcelApp API supports a filter_mode parameter:

  • recent (default) - Returns all recent parcels including delivered ones
  • active - Returns only active/in-transit parcels

Some users prefer to see only active shipments to reduce clutter, while others want to see recently delivered packages. This PR gives users the choice.

Related to discussions about completed parcels appearing in the list.

Changes

  • Added FILTER_MODE_RECENT, FILTER_MODE_ACTIVE, and DEFAULT_FILTER_MODE constants
  • Updated ParcelUpdateCoordinator to read filter_mode from options
  • Added filter_mode selector to Options Flow with dropdown UI
  • Added translation strings for the new option
  • Filter mode persists across restarts via config entry options

Configuration

Users can change the filter mode in:
Settings → Devices & Services → Parcel App → Configure

Options:

  • Recent (includes completed) - Shows all recent parcels
  • Active (excludes completed) - Shows only in-transit parcels

Testing

  • All tests pass (11/11)
  • Options flow tested with both filter modes

Adds a new configuration option allowing users to choose between "recent"
and "active" filter modes when fetching parcel data from the API.

- "Recent" (default): Includes recently completed deliveries alongside active ones
- "Active": Shows only parcels that are still in transit or pending delivery

This aligns with the Parcel App API which supports the filter_mode parameter
with values "recent" (default) or "active".

Changes:
- const.py: Added FILTER_MODE_RECENT, FILTER_MODE_ACTIVE, DEFAULT_FILTER_MODE
- coordinator.py: Read filter_mode from options and use in API URL
- config_flow.py: Added filter_mode dropdown to options schema
- translations/en.json: Added filter_mode label and description

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@PineappleEmperor PineappleEmperor self-requested a review January 24, 2026 12:44
Copy link
Collaborator

@PineappleEmperor PineappleEmperor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already provide an ACTIVE sensor and a RECENT sensor that users are free to use/disable depending on what they need. The API request for active data is a superset of the recent data, so there's no need to provide an option for both.

Feel free to respond, but I see this as complexity without purpose.

@robbybarnes
Copy link
Author

Fair enough. In testing out some changes on my side I just preferred doing it this way, but I don't disagree with what you're saying. No strong feelings either way, I'm good with just closing this one out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants