[cpap] Add invert water logic and auto refill for CPAP filling use case#28
[cpap] Add invert water logic and auto refill for CPAP filling use case#28
Conversation
Adds two new optional config switches (off by default): - Invert Water Logic: flips input sensor meaning so DRY = destination low = start pump, WET = destination full = stop pump - Auto Refill: automatically triggers pumpUntilFull when input sensor goes dry in inverted mode Resolves #22
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThis PR adds automated CPAP reservoir refill logic by introducing two new template switches ( Changes
Sequence DiagramsequenceDiagram
participant FIS as Fluid Input Sensor
participant AR as Auto Refill Switch
participant IWL as Invert Water Logic Switch
participant PC as Pump Control
participant Pump as Pump System
FIS->>AR: on_release event triggered
AR->>AR: Check if auto_refill is on
AR->>IWL: Check if invert_water_logic is on
IWL->>PC: Check if pump_control is off
PC->>Pump: Conditions met: execute pumpUntilFull
Pump->>Pump: Log action and refill reservoir
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Integrations/ESPHome/Core.yaml`:
- Around line 420-427: The inverted-mode branch currently stops the pump when
invert_water_logic is true and fluid_input_sensor goes wet, which can
prematurely stop pumpUntilFull; update the condition in that branch so it checks
the actual full-level sensor (the full-stop sensor used by pumpUntilFull) rather
than fluid_input_sensor (or add an additional check requiring the full-level
sensor to be on) before calling switch.turn_off on pump_control; locate the
branch using invert_water_logic, fluid_input_sensor and pump_control and
replace/augment the condition to reference the full-level sensor used by
pumpUntilFull.
When stop_pump_when_full is ON, the output sensor already handles full detection. Skip the inverted-mode input sensor stop to prevent the pump from stopping as water passes the low-level sensor on the way to full.
Version: 25.12.18.1
What does this implement/fix?
Adds inverted water logic and auto refill support for CPAP humidifier tank filling use case.
pumpUntilFullwhenever the input sensor goes DRY (tank level drops below sensor 1).Stop Pump When Input Drycheck so it does not fire in inverted mode.CPAP Setup Instructions
Closes #22
Types of changes
Checklist / Checklijst:
If user-visible functionality or configuration variables are added/modified:
Summary by CodeRabbit
Release Notes
New Features
Improvements