Skip to content

Add filter change reminder notification feature - #2

Open
MiroStW wants to merge 5 commits into
SyButter:mainfrom
MiroStW:feature/filter-notifications
Open

Add filter change reminder notification feature#2
MiroStW wants to merge 5 commits into
SyButter:mainfrom
MiroStW:feature/filter-notifications

Conversation

@MiroStW

@MiroStW MiroStW commented Oct 20, 2025

Copy link
Copy Markdown

Summary

This PR adds a filter change reminder notification feature that alerts users when they reach a configurable water usage threshold.

Screenshot_20251022_085309_AndroWish

New Features

Filter Change Reminder Notification

  • Users can set a water usage threshold (in L or gallons)
  • Automatic popup notification when threshold is reached
  • Threshold respects current unit selection (L/gallons)
  • Notification can be triggered again after changing the threshold
  • Notification resets when the counter is reset

UI Improvements

  • New input field for "Filter change reminder (L or gal)"
  • Proper spacing to avoid element overlap
  • Done button now saves threshold before closing settings

Implementation Details

  • Threshold stored internally in milliliters for consistency
  • Display value auto-converts based on selected units
  • notification_shown flag tracks whether notification was displayed
  • Flag resets when:
    • Counter is reset (for next filter cycle)
    • Threshold value is changed (to allow notification at new threshold)

Testing

✅ Tested on DE1 production environment
✅ UI properly spaced and readable
✅ Threshold saves correctly when Done button is clicked
✅ Notification displays at correct threshold
✅ Notification can be triggered again after changing threshold
✅ Unit conversion works correctly between L and gallons

Closes

  • TODO item: "Add a ping to let you know when a set total L/gal has been reached for filter change"

Version bumped from 0.1 to 0.2

Miro Wilms added 5 commits October 19, 2025 21:37
The duplicate 'variable plugin_name' inside the namespace was causing
namespace resolution issues during plugin initialization. The plugin
system uses the directory name to create the namespace, making this
internal variable declaration redundant and problematic.

This fixes the 'can't read ::plugins::de1_water_tracker_plugin::version'
error that prevented the plugin from loading.
Replace namespace variable references with string literals for
save_plugin_settings calls, matching the pattern used by other
established plugins like advanced_rest_api.

This makes the code more maintainable and consistent with DE1 plugin
conventions.
Remove '_plugin' suffix from plugin name to follow naming conventions
used by other established plugins (e.g., advanced_rest_api, mqtt).

The directory should also be renamed from de1_water_tracker_plugin
to de1_water_tracker when installing.

This is a breaking change - users will need to:
1. Disable and remove the old de1_water_tracker_plugin
2. Install the renamed de1_water_tracker plugin
Implements the TODO item to notify users when a water usage threshold is reached.

Features:
- New setting for filter change reminder threshold (in L or gal)
- Automatic notification popup when threshold is reached
- Threshold respects current unit selection (L/gallons)
- Notification flag resets when threshold is changed
- UI input field with auto-conversion based on selected units
- Done button saves threshold before closing settings

The notification flag is reset when:
- Counter is reset (allows notification for next cycle)
- Threshold value is changed (allows notification at new threshold)

Closes: TODO item 'Add a ping to let you know when a set total L/gal
has been reached for filter change'

Version bumped to 0.2

Tested and verified working:
- UI properly spaced to avoid overlapping elements
- Threshold saves correctly when Done button is clicked
- Notification shows at correct threshold
- Notification can be triggered again after changing threshold
- Add dedicated water_filter_warning page with dismiss button
- Warning page displays once per filter cycle (until reset/threshold change)
- More prominent and impossible to miss compared to popup
- Follows DE1 conventions for message pages
- Universal across all skins
@MiroStW

MiroStW commented Oct 22, 2025

Copy link
Copy Markdown
Author

Update: Replaced Popup with Custom Warning Page

Based on feedback from the DE1 maintainer, I've improved the notification mechanism:

What Changed

  • Before: Used popup function (small toast that quickly fades away, easy to miss)
  • After: Custom dedicated warning page that user must actively dismiss

Why This Is Better

  • More prominent: Full-screen warning page with red title - impossible to miss
  • Requires acknowledgment: User must press OK button to dismiss and return to off page
  • Universal: Works consistently across all skins (no skin-specific code)
  • Not annoying: Still only shows once per filter cycle (until reset/threshold change)

Technical Implementation

  • Created water_filter_warning page using standard DE1 page conventions
  • Follows same pattern as built-in infopage and message pages
  • Uses page_to_show_when_off for proper navigation
  • Maintains all existing behavior with notification_shown flag

This ensures users never miss the important reminder to change their water filter! ✨

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.

1 participant