Skip to content

Expose water filter expiry date and remaining gallons - #101

Merged
JonGilmore merged 3 commits into
JonGilmore:mainfrom
mwbourgeois:feat/water-filter-end-date-and-gallons
May 13, 2026
Merged

JonGilmore merged 3 commits into
JonGilmore:mainfrom
mwbourgeois:feat/water-filter-end-date-and-gallons

Conversation

@mwbourgeois

@mwbourgeois mwbourgeois commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

/My/ fridge exposes these sensors. Totally open to rejecting this PR or modification if they are atypical sensors to be reported.

Summary by CodeRabbit

  • New Features

    • Added water filter sensors for refrigerator appliances, including remaining capacity in gallons and filter expiration date.
  • Chores

    • Enhanced CI workflow for improved package reference handling during fork and PR testing.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: aa2b6f9a-03ee-4aae-a998-82c10f091716

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
components/subzero_protocol/protocol.cpp (1)

270-280: 💤 Low value

Consider validating the date format more thoroughly.

The current check v.size() == 10 && v[4] == '-' && v[7] == '-' accepts any 10-character string with dashes in the right positions (e.g., "ABCD-EF-GH"). While the appliance protocol is controlled and unlikely to send malformed dates, a more robust validation would improve safety.

However, given that:

  • The input source is a known appliance protocol (not user input)
  • Invalid formats pass through unchanged (defensive fallback)
  • Test coverage validates the happy path

The current implementation is acceptable for this use case.

Optional enhancement: Add a regex or character-range check to validate YYYY-MM-DD format if you want defense-in-depth.

♻️ Optional: More robust date validation
  if (auto raw = opt_str(data["water_filter_end_date"])) {
    const std::string &v = *raw;
-   if (v.size() == 10 && v[4] == '-' && v[7] == '-') {
+   // Validate YYYY-MM-DD format (year, month, day are digits)
+   if (v.size() == 10 && v[4] == '-' && v[7] == '-' &&
+       std::isdigit(v[0]) && std::isdigit(v[1]) && std::isdigit(v[2]) && std::isdigit(v[3]) &&
+       std::isdigit(v[5]) && std::isdigit(v[6]) &&
+       std::isdigit(v[8]) && std::isdigit(v[9])) {
      state.water_filter_end_date = v + "T00:00:00+00:00";
    } else {
      state.water_filter_end_date = v;
    }
  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/subzero_protocol/protocol.cpp` around lines 270 - 280, The current
date promotion uses a brittle positional check (v.size()==10 && v[4]=='-' &&
v[7]=='-') which can accept non-digit characters; update the validation inside
the opt_str(data["water_filter_end_date"]) block to ensure the string truly
matches YYYY-MM-DD before appending "T00:00:00+00:00" — e.g., replace the simple
positional test on v with either a std::regex match for R"(\d{4}-\d{2}-\d{2})"
or explicit isdigit checks for v[0..3], v[5..6], v[8..9]; keep the defensive
fallback of assigning state.water_filter_end_date = v when the check fails and
continue using state.water_filter_end_date = v + "T00:00:00+00:00" when the
validation passes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@components/subzero_protocol/protocol.cpp`:
- Around line 270-280: The current date promotion uses a brittle positional
check (v.size()==10 && v[4]=='-' && v[7]=='-') which can accept non-digit
characters; update the validation inside the
opt_str(data["water_filter_end_date"]) block to ensure the string truly matches
YYYY-MM-DD before appending "T00:00:00+00:00" — e.g., replace the simple
positional test on v with either a std::regex match for R"(\d{4}-\d{2}-\d{2})"
or explicit isdigit checks for v[0..3], v[5..6], v[8..9]; keep the defensive
fallback of assigning state.water_filter_end_date = v when the check fails and
continue using state.water_filter_end_date = v + "T00:00:00+00:00" when the
validation passes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e840fd32-f11a-446c-989f-a43f194bc20e

📥 Commits

Reviewing files that changed from the base of the PR and between 61b2949 and 45ee5b5.

📒 Files selected for processing (11)
  • .github/workflows/ci.yml
  • components/subzero_appliance/__init__.py
  • components/subzero_appliance/appliance.h
  • components/subzero_protocol/dispatch.h
  • components/subzero_protocol/dispatch_esphome.h
  • components/subzero_protocol/protocol.cpp
  • components/subzero_protocol/protocol.h
  • tests/cpp/dispatch_test.cpp
  • tests/cpp/protocol_test.cpp
  • tests/fixtures/fridge_back_2028_d5_full.expected.json
  • tests/fixtures/fridge_pro3650g_d4_full.expected.json

@JonGilmore JonGilmore left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

thanks for the PR!

@JonGilmore
JonGilmore merged commit da94ec1 into JonGilmore:main May 13, 2026
6 checks passed
@way-lo

way-lo commented May 13, 2026

Copy link
Copy Markdown

@mwbourgeois Could you comment on what model fridge you have?

@mwbourgeois

Copy link
Copy Markdown
Contributor Author

@mwbourgeois Could you comment on what model fridge you have?

36UFDID

JonGilmore added a commit that referenced this pull request May 16, 2026
JonGilmore added a commit that referenced this pull request May 16, 2026
…105)

* fix: additional flag to hide filter expiry date & remaining gallons

code still defaults to show these sensors, but allows users to turn them off if their models do not support them

closes #104

* swap default

* fix test coverage from #101
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.

3 participants