Skip to content

Release 26.3.2.1 - New sensors, ESPHome modernisation, and bug fixes#68

Merged
TrevorSchirmer merged 43 commits intomainfrom
beta
Mar 30, 2026
Merged

Release 26.3.2.1 - New sensors, ESPHome modernisation, and bug fixes#68
TrevorSchirmer merged 43 commits intomainfrom
beta

Conversation

@bharvey88
Copy link
Copy Markdown
Contributor

@bharvey88 bharvey88 commented Mar 27, 2026

Version: 26.3.2.1

What does this implement/fix?

Merges beta into main for the 26.3.2.1 release. Changes include:

  • ESPHome modernisationesp32c3 board variant + flash_size: 4MB, remove legacy platformio options and BLE on_connect/on_disconnect wifi hooks from Factory YAML (breaking: board spec change)
  • API services → actions renameplay_buzzer, calibrate_co2_value, set_ld2410_bluetooth_password renamed from services to actions (breaking: existing HA automations calling these services will need updating)
  • General occupancy sensor — union of all three zone sensors
  • Configurable LTR390 update interval — adjustable 1–300s via web interface, persisted across reboots
  • Configurable DPS310 pressure offset — disabled by default
  • IP address text sensor — via wifi_info platform
  • ESPHome version + Apollo firmware version text sensors
  • Logger configuration added to MSR-2.yaml for easier troubleshooting
  • Bug fixes — initial value reporting when reduce_db_reporting=true, LTR390 interval NaN handling, Apollo firmware version showing "unknown", pressure offset incorrectly applied to non-DPS310 sensors, ESPHome 2025.8.0 LD2410 throttle update

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

Release Notes

  • New Features

    • Added pressure offset adjustment for accurate readings.
    • Added configurable update interval for environmental sensor.
    • Introduced combined radar occupancy detection across multiple zones.
    • Converted three operations to actions: buzzer control, CO₂ calibration, and Bluetooth password configuration.
    • Added diagnostic information display for IP address and firmware version.
  • Bug Fixes

    • Enhanced sensor filtering and responsiveness for radar and temperature readings.
  • Chores

    • Updated device board configuration and metadata.

kbx81 and others added 30 commits August 12, 2025 20:57
add logger to MSR-2.yaml for better troubleshooting
Fix  reporting of initial values when reduce_db_reporting=true
Adds a general occupancy sensor that serves as a union of all three zone sensors
Add general occupancy sensor
Allows users to adjust the LTR390 sensor update frequency from the default
60 seconds to any value between 1-300 seconds through the web interface,
eliminating the need for YAML edits and firmware recompilation.

Uses ESPHome's interval component to manually poll the sensor at the
configured rate, as sensor platform update_interval is not templatable.

The setting is exposed as a number input under the CONFIG entity category
with values persisted across device reboots.

Resolves #54

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add check for first boot condition (last_update == 0 && current_time > 0)
to trigger an immediate sensor update instead of waiting for the full
configured interval to elapse.

The current_time > 0 guard prevents edge case where both values are 0
in the first second after boot.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- esp32: board -> variant: esp32c3 + flash_size: 4MB
- Remove platformio_options board_build.flash_mode from all device YAMLs
- MSR-2_Factory: remove legacy BLE on_connect/on_disconnect wifi hooks
[esphome] Modernise board spec and remove legacy platformio/BLE config
TrevorSchirmer and others added 13 commits February 28, 2026 11:36
[version] Add ESPHome version and Apollo firmware version sensors
dps310_pressure_offset was incorrectly applied to three sensors that
have no relation to barometric pressure: ESP internal temperature,
LTR390 light, and LTR390 UV Index. The offset is now applied only in
the DPS310 pressure sensor lambda where it belongs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
[apollo_msr-2] Add configurable DPS310 pressure offset
…ble-settings

Add configurable update interval for LTR390 sensor
Bump version to 26.3.2.1
Fix LTR390 interval lambda: handle NAN state, remove boot timing guard
Fix Apollo Firmware Version sensor showing unknown
Per ESPHome dev feedback: the version is a compile-time constant, so
publish it once on_boot rather than using a lambda with periodic updates.
Move publish from priority 900 to separate 500 block in MSR-2.yaml.
Add publish at priority 500 to MSR-2_BLE and MSR-2_Factory.
Fix: publish firmware version once on boot instead of polling
@github-actions github-actions bot added the breaking-change Breaking change label Mar 27, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

Walkthrough

This PR introduces sensor calibration and control enhancements to ESPHome configurations: converting Home Assistant API endpoints from services to actions, adding configurable sensor offsets and update intervals (DPS310 pressure, LTR390), creating a composite radar occupancy sensor, adjusting sensor filtering thresholds, and adding diagnostic firmware version sensors across multiple device configurations.

Changes

Cohort / File(s) Summary
Core Sensor Configuration
Integrations/ESPHome/Core.yaml
Added template numbers for DPS310 pressure offset and LTR390 update interval control; added global state tracking for LTR390; implemented DPS310 offset in pressure sensor pipeline; added 1s interval controller for rate-controlled LTR390 updates; created composite radar zone occupancy binary sensor; adjusted sensor filtering with higher delta thresholds and throttle filters; converted three Home Assistant API endpoints from services to actions; added diagnostic text sensors for IP address, ESPHome version, and firmware version.
Device Boot & Configuration Updates
Integrations/ESPHome/MSR-2.yaml, Integrations/ESPHome/MSR-2_BLE.yaml, Integrations/ESPHome/MSR-2_Factory.yaml
Removed PlatformIO flash mode override; added on\_boot handlers at priority 500 to publish Apollo firmware version; removed WiFi-BLE toggle handlers in Factory variant.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • MSR-2#56: Directly related—adds same LTR390 update interval control (global state tracking, template number, sensor update frequency), rate-limiting mechanism, and 1s interval controller.
  • MSR-2#62: Directly related—modifies same DPS310 pressure sensor by introducing configurable pressure offset with NaN guarding and pipeline integration.
  • MSR-2#58: Directly related—adds same WiFi IP address diagnostic text sensor to Core.yaml.

Suggested labels

new-feature, bugfix

Suggested reviewers

  • TrevorSchirmer

Poem

🐰 Sensors hum with fresh new grace,
Offsets tuned to time and place,
Radar zones now dance as one,
Actions bloom where services shone,
Firmware whispers at each dawn!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title comprehensively captures the main categories of changes: ESPHome modernisation, new sensors, and bug fixes, matching the PR's scope.
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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 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.

❤️ Share

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

@bharvey88 bharvey88 added the new-feature New feature label Mar 27, 2026
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 643-659: The delta filter currently compares the offset-adjusted
value and can drop updates that are actually only offset changes; modify the
lambda used for dps310pressure to track the last applied offset as well as
last_reported_value (add a static float last_reported_offset = NAN), compute
current_value = x + offset as now, but if id(reduce_db_reporting).state is true
then also check whether the offset has changed (considering isnan) — if the
offset differs from last_reported_offset then update last_reported_offset and
last_reported_value and return current_value so offset-only tweaks are reported;
otherwise keep the existing delta comparison against last_reported_value and
return {} when below threshold. Ensure you reference id(dps310_pressure_offset)
and id(reduce_db_reporting) and update the existing static last_reported_value
accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd15d0aa-03e5-46c3-8bf5-21b63bac79d0

📥 Commits

Reviewing files that changed from the base of the PR and between afe8348 and e4c7f95.

📒 Files selected for processing (4)
  • Integrations/ESPHome/Core.yaml
  • Integrations/ESPHome/MSR-2.yaml
  • Integrations/ESPHome/MSR-2_BLE.yaml
  • Integrations/ESPHome/MSR-2_Factory.yaml

Comment on lines 643 to 659
- lambda: |-
static float last_reported_value = 0.0;
static float last_reported_value = -6.0;
float current_value = x;
float offset = id(dps310_pressure_offset).state;
if (!isnan(offset)) {
current_value += offset;
}

// Check if the reduce_db_reporting switch is on
if (id(reduce_db_reporting).state) {
// Apply delta filter: only report if the value has changed by 2 or more
// Apply delta filter: only report if the value has changed by 5 or more
if (abs(current_value - last_reported_value) >= 5.0) {
last_reported_value = current_value; // Update the last reported value
return current_value;
} else {
// Return the last reported value without updating if change is less than 2
// Return the last reported value without updating if change is less than 5
return {}; // Discard the update
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 | 🟠 Major

Do not let the delta filter swallow offset-only changes.

When reduce_db_reporting is on, a calibration change smaller than 5 hPa never reaches dps310pressure because the new offset is applied before the delta comparison. A stable sensor with a +1.0 hPa tweak will keep returning {}, so the displayed pressure — and the scd40 compensation source wired to it — stays stale.

Proposed fix
         - lambda: |-
             static float last_reported_value = -6.0;
+            static float last_offset = NAN;
             float current_value = x;
             float offset = id(dps310_pressure_offset).state;
+            bool offset_changed = isnan(last_offset) ||
+                                  (isnan(offset) != isnan(last_offset)) ||
+                                  (!isnan(offset) && fabsf(offset - last_offset) >= 0.001f);
             if (!isnan(offset)) {
               current_value += offset;
             }
+            if (offset_changed) {
+              last_offset = offset;
+              last_reported_value = current_value;
+              return current_value;
+            }
 
             // Check if the reduce_db_reporting switch is on
             if (id(reduce_db_reporting).state) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- lambda: |-
static float last_reported_value = 0.0;
static float last_reported_value = -6.0;
float current_value = x;
float offset = id(dps310_pressure_offset).state;
if (!isnan(offset)) {
current_value += offset;
}
// Check if the reduce_db_reporting switch is on
if (id(reduce_db_reporting).state) {
// Apply delta filter: only report if the value has changed by 2 or more
// Apply delta filter: only report if the value has changed by 5 or more
if (abs(current_value - last_reported_value) >= 5.0) {
last_reported_value = current_value; // Update the last reported value
return current_value;
} else {
// Return the last reported value without updating if change is less than 2
// Return the last reported value without updating if change is less than 5
return {}; // Discard the update
- lambda: |-
static float last_reported_value = -6.0;
static float last_offset = NAN;
float current_value = x;
float offset = id(dps310_pressure_offset).state;
bool offset_changed = isnan(last_offset) ||
(isnan(offset) != isnan(last_offset)) ||
(!isnan(offset) && fabsf(offset - last_offset) >= 0.001f);
if (!isnan(offset)) {
current_value += offset;
}
if (offset_changed) {
last_offset = offset;
last_reported_value = current_value;
return current_value;
}
// Check if the reduce_db_reporting switch is on
if (id(reduce_db_reporting).state) {
// Apply delta filter: only report if the value has changed by 5 or more
if (abs(current_value - last_reported_value) >= 5.0) {
last_reported_value = current_value; // Update the last reported value
return current_value;
} else {
// Return the last reported value without updating if change is less than 5
return {}; // Discard the update
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Integrations/ESPHome/Core.yaml` around lines 643 - 659, The delta filter
currently compares the offset-adjusted value and can drop updates that are
actually only offset changes; modify the lambda used for dps310pressure to track
the last applied offset as well as last_reported_value (add a static float
last_reported_offset = NAN), compute current_value = x + offset as now, but if
id(reduce_db_reporting).state is true then also check whether the offset has
changed (considering isnan) — if the offset differs from last_reported_offset
then update last_reported_offset and last_reported_value and return
current_value so offset-only tweaks are reported; otherwise keep the existing
delta comparison against last_reported_value and return {} when below threshold.
Ensure you reference id(dps310_pressure_offset) and id(reduce_db_reporting) and
update the existing static last_reported_value accordingly.

@TrevorSchirmer TrevorSchirmer merged commit a1b33df into main Mar 30, 2026
12 checks passed
@TrevorSchirmer TrevorSchirmer deleted the beta branch March 30, 2026 16:31
@TrevorSchirmer TrevorSchirmer restored the beta branch March 30, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Breaking change new-feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants