Release 26.3.2.1 - New sensors, ESPHome modernisation, and bug fixes#68
Release 26.3.2.1 - New sensors, ESPHome modernisation, and bug fixes#68TrevorSchirmer merged 43 commits intomainfrom
Conversation
add logger to MSR-2.yaml for better troubleshooting
Add logger configuration to MSR-2.yaml
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
Update for ESPHome 2025.8.0 release
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>
…_ld2410_bluetooth_password)
- 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
[api] Rename services to actions
[wifi_info] Add IP address text sensor
[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
WalkthroughThis 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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 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
📒 Files selected for processing (4)
Integrations/ESPHome/Core.yamlIntegrations/ESPHome/MSR-2.yamlIntegrations/ESPHome/MSR-2_BLE.yamlIntegrations/ESPHome/MSR-2_Factory.yaml
| - 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 |
There was a problem hiding this comment.
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.
| - 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.
Version: 26.3.2.1
What does this implement/fix?
Merges beta into main for the 26.3.2.1 release. Changes include:
esp32c3board variant +flash_size: 4MB, remove legacy platformio options and BLE on_connect/on_disconnect wifi hooks from Factory YAML (breaking: board spec change)play_buzzer,calibrate_co2_value,set_ld2410_bluetooth_passwordrenamed fromservicestoactions(breaking: existing HA automations calling these services will need updating)wifi_infoplatformreduce_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 updateTypes of changes
Checklist / Checklijst:
If user-visible functionality or configuration variables are added/modified:
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Chores