Skip to content

[apollo_air-1] Add configurable DPS310 pressure offset#77

Closed
bharvey88 wants to merge 1 commit intobetafrom
apollo_air-1-dps310-pressure-offset
Closed

[apollo_air-1] Add configurable DPS310 pressure offset#77
bharvey88 wants to merge 1 commit intobetafrom
apollo_air-1-dps310-pressure-offset

Conversation

@bharvey88
Copy link
Copy Markdown
Contributor

@bharvey88 bharvey88 commented Feb 24, 2026

Version: 26.2.24.1

What does this implement/fix?

Adds a user-configurable pressure offset (DPS310 Pressure Offset) to the DPS310 sensor, following the same pattern already used for the SEN55 temperature and humidity offsets. The offset is exposed as a number entity (CONFIG category, ±100 hPa range, 0.1 hPa step, persists across reboots). A lambda filter applies it to the reported pressure value.

The SCD40's ambient pressure compensation source (dps310pressure) automatically benefits from the corrected value.

Types of changes

  • Bugfix (fixed change that fixes an issue)
  • New feature (thanks!)
  • Breaking change (repair/feature that breaks existing functionality)
  • Dependency Update - Does not publish
  • Other - Does not publish
  • Website of github readme file update - Does not publish
  • Github workflows - Does not publish

Checklist / Checklijst:

  • The code change has been tested and works locally
  • The code change has not yet been tested

If user-visible functionality or configuration variables are added/modified:

  • Added/updated documentation for the web page

Summary by CodeRabbit

  • New Features

    • DPS310 sensors now support pressure offset calibration, allowing adjustment of pressure readings within a -100.0 to 100.0 hPa range.
  • Updates

    • Version updated to 26.2.24.1.
    • DPS310 sensor configuration enhanced to automatically apply offset corrections to pressure measurements.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 24, 2026

Walkthrough

Version updated to 26.2.24.1. A new DPS310 Pressure Offset number entity was added with configurable range and initial value. The DPS310 sensor configuration was modified to apply this offset through a lambda filter for dynamic pressure adjustment.

Changes

Cohort / File(s) Summary
ESPHome Configuration
Integrations/ESPHome/Core.yaml
Version bumped to 26.2.24.1. Added new DPS310 Pressure Offset number platform entity with range [-100.0, 100.0] hPa and restore_value support. Updated DPS310 Pressure sensor filter to apply the offset via lambda calculation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit hops through configs with cheer,
New offsets bloom, the pressure crystal clear!
From 25.12 to 26.2 we hop along,
DPS310 dances to the filter's song. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a configurable DPS310 pressure offset. It aligns directly with the PR objectives and file changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch apollo_air-1-dps310-pressure-offset

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 228-229: The DPS310 pressure offset filter uses the opposite sign
from the SEN55 offsets; change the filter in the DPS310 sensor's filters lambda
(the expression using id(dps310_pressure_offset).state) to subtract the stored
offset (matching the SEN55 pattern used by id(sen55_temperature_offset) and
id(sen55_humidity_offset)) so users apply offsets with the same sign convention
across sensors.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e523911 and 7f8a507.

📒 Files selected for processing (1)
  • Integrations/ESPHome/Core.yaml

Comment on lines +228 to +229
filters:
- lambda: return x + id(dps310_pressure_offset).state;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent sign convention vs. the existing SEN55 offsets.

Both SEN55 offsets subtract the stored value:

# lines 257, 263
- lambda: return x - id(sen55_temperature_offset).state;
- lambda: return x - id(sen55_humidity_offset).state;

The new DPS310 filter adds:

- lambda: return x + id(dps310_pressure_offset).state;

With the SEN55 convention, a user sets +2 to mean "the sensor reads 2 units too high — correct it down." With the additive convention here, the same user would need to set −2 to achieve the same downward correction — opposite intuition. Both approaches are functionally valid (the ±100 range covers both directions), but the inconsistency is a UX hazard for anyone who has already calibrated SEN55.

Consider aligning with the SEN55 convention:

🔧 Proposed fix
-        - lambda: return x + id(dps310_pressure_offset).state;
+        - lambda: return x - id(dps310_pressure_offset).state;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Integrations/ESPHome/Core.yaml` around lines 228 - 229, The DPS310 pressure
offset filter uses the opposite sign from the SEN55 offsets; change the filter
in the DPS310 sensor's filters lambda (the expression using
id(dps310_pressure_offset).state) to subtract the stored offset (matching the
SEN55 pattern used by id(sen55_temperature_offset) and
id(sen55_humidity_offset)) so users apply offsets with the same sign convention
across sensors.

@bharvey88
Copy link
Copy Markdown
Contributor Author

Superseded by #78 (branch renamed to dps310-pressure-offset)

@bharvey88 bharvey88 closed this Feb 24, 2026
@bharvey88 bharvey88 deleted the apollo_air-1-dps310-pressure-offset branch February 24, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants