Make CO2 auto calibration toggle work at runtime#58
Conversation
|
Warning Review limit reached
More reviews will be available in 42 minutes and 33 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ 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 |
954bf39 to
5f3dd04
Compare
Rename the hidden "SCD40 Automatic Self Calibration" switch to "CO2 Auto Calibration" (visible by default) to match the other SCD40 products, and make toggling it take effect immediately. The old implementation only set the component's in-memory flag, which is not written to the sensor until the next reboot. The new script stops periodic measurement, sends the ASC command over I2C, and restarts measurement. The restored switch state re-applies the user's choice after every boot, replacing the on_boot lambdas in the device configs. Also set automatic_self_calibration explicitly instead of relying on the ESPHome default. Note: the entity rename means a previously saved switch state does not carry over; devices fall back to the default (on) after updating.
5f3dd04 to
874d09a
Compare
Version: 26.6.10.1
What does this implement/fix?
Makes the CO2 auto calibration toggle actually work at runtime, and renames it for consistency with the other SCD40 products.
disabled_by_default: true). The replacement "CO2 Auto Calibration" switch (same name as the new AIR-1/MSR-2/MTR-1 switch) is visible by default and takes effect immediately: the script stops periodic measurement, sends the ASC command over I2C, and restarts measurement. The saved choice is re-applied ~20 seconds after every boot.on_bootre-apply lambdas in R_PRO-1_W.yaml and R_PRO-1_ETH.yaml are removed; the restored switch state now handles boot re-apply through the same script (one mechanism instead of two).automatic_self_calibration: trueis now set explicitly instead of relying on the ESPHome default, so there is no calibration behavior change: ASC was already on by default for the R_PRO-1.Migration caveat for release notes (why this is marked breaking): the entity rename breaks any automation or dashboard referencing the old switch entity, and means a previously saved switch state does not carry over; devices fall back to the default (on) after updating. Anyone who had the old hidden switch turned off needs to turn the new one off once. Small audience, since the old switch was hidden and required a reboot to act.
This is part of the same rollout as AIR-1, MSR-2, and MTR-1 (which flip ASC from off to on and gain the same switch). A wiki update covering all four products is ready to merge alongside the firmware releases.
Verification:
esphome compilepasses for R_PRO-1_W.yaml and R_PRO-1_ETH.yaml (ESPHome 2026.1.3). Not yet tested on hardware.Types of changes
Checklist / Checklijst:
If user-visible functionality or configuration variables are added/modified:
🤖 Generated with Claude Code