Skip to content

Conversation

@cadejager
Copy link

@cadejager cadejager commented Jan 8, 2026

Version: 26.1.7.1

What does this implement/fix?

Adds SCD Temperature and SCD Humidity sensors and offsets

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

^ I am not sure what you want here. This git repo doesn't seem to document specific sensors.

Summary by CodeRabbit

  • New Features

    • Added configurable temperature and humidity offset templates for SCD40 sensors, enabling adjustment of sensor readings
    • Introduced named identifiers for radar zone configuration, providing enhanced flexibility for radar sensor setup
  • Chores

    • Updated ESPHome Core to the latest version

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

Walkthrough

ESPHome Core version updated from 25.8.6.1 to 26.1.7.1. New configuration templates added for SCD40 temperature and humidity offset controls (number platform). SCD4X sensor extended with temperature and humidity sub-sensors using the new offset filters. Radar zone template identifiers introduced.

Changes

Cohort / File(s) Summary
Version & Sensor Configuration
Integrations/ESPHome/Core.yaml
Version bump to 26.1.7.1. Added number platform templates for SCD40 Temperature Offset and SCD40 Humidity Offset with range, unit, and disabled_by_default settings. Extended SCD4X sensor with temperature and humidity sub-sensors, each with offset delta filters referencing the new number templates. Added identifiers (radar_z1_start, radar_z1_end, radar_z2_end, radar_z3_end) to radar zone template definitions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A version hop from eight to one,
New sensors bloom, the work is done,
Offsets configured, zones now named,
ESPHome's garden, perfectly framed! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'added SCD Humidity and Temp sensors' directly matches the primary change in the changeset, which adds SCD temperature and humidity sensors along with their corresponding offset templates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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

@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

🤖 Fix all issues with AI agents
In @Integrations/ESPHome/Core.yaml:
- Around line 174-187: The humidity offset sensor (platform: template, name:
SCD40 Humidity Offset, id: scd40_humidity_offset) allows an excessively large
range; change its min_value and max_value to safer bounds (e.g., set min_value
to -50.0 and max_value to 50.0, or -30.0/+30.0 if you prefer stricter limits) so
offsets cannot produce humidity readings outside 0–100%; keep all other
properties (restore_value, initial_value, unit_of_measurement, step, mode,
disabled_by_default) unchanged.
🧹 Nitpick comments (1)
Integrations/ESPHome/Core.yaml (1)

395-406: Consider adding Home Assistant metadata for better integration.

While ESPHome may infer these properties from the platform, explicitly specifying device_class, unit_of_measurement, and state_class improves Home Assistant integration and enables features like long-term statistics.

♻️ Suggested metadata additions
     temperature:
       name: "SCD40 Temperature"
       id: scd40_temperature
       disabled_by_default: true
+      device_class: temperature
+      unit_of_measurement: "°C"
+      state_class: measurement
       filters:
         - lambda: return x - id(scd40_temperature_offset).state;
     humidity:
       name: "SCD40 Humidity"
       id: scd40_humidity
       disabled_by_default: true
+      device_class: humidity
+      unit_of_measurement: "%"
+      state_class: measurement
       filters:
         - lambda: return x - id(scd40_humidity_offset).state;
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5eec7e2 and e2c0922.

📒 Files selected for processing (1)
  • Integrations/ESPHome/Core.yaml
🔇 Additional comments (3)
Integrations/ESPHome/Core.yaml (3)

3-3: LGTM!

Version bump matches the PR description.


160-173: These offset values (14.54°C for DPS310 and 18.86°C for SCD40) are factory calibration constants measured for this specific MSR-2 hardware, not arbitrary user defaults. The precision and consistency of these values across sensors, combined with their stability since the initial commit, indicates they are verified calibration data. While they are in the CONFIG category (allowing user adjustment), they represent the tested baseline for the hardware.

Likely an incorrect or invalid review comment.


395-406: Offset direction is intentional and ESPHome compatible.

The subtraction-based offset (line 400 and 406) is consistent with the DPS310 pattern (line 655) and intentional for this device. The initial temperature offset of +18.86°C is a device-specific calibration value, and the negative offset direction is confirmed by design. ESPHome officially supports filters on scd4x temperature and humidity sensors, so this implementation is compatible.

Comment on lines +174 to +187
- platform: template
name: SCD40 Humidity Offset
id: scd40_humidity_offset
restore_value: true
initial_value: 0
min_value: -70.0
max_value: 70.0
entity_category: "CONFIG"
unit_of_measurement: "%"
optimistic: true
update_interval: never
step: 0.1
mode: box
disabled_by_default: true
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Constrain the humidity offset range to prevent invalid values.

The offset range of -70.0 to 70.0% could produce invalid humidity readings outside the valid 0-100% range. For example, a 50% humidity reading with a -70% offset would result in -20%, or an 80% reading with a +70% offset would produce 150%.

Consider reducing the range to -50.0 to 50.0 (or even -30.0 to 30.0) to minimize the possibility of invalid values.

♻️ Suggested range adjustment
   - platform: template
     name: SCD40 Humidity Offset
     id: scd40_humidity_offset
     restore_value: true
     initial_value: 0
-    min_value: -70.0
-    max_value: 70.0
+    min_value: -50.0
+    max_value: 50.0
     entity_category: "CONFIG"
     unit_of_measurement: "%"
     optimistic: true
     update_interval: never
     step: 0.1
     mode: box
     disabled_by_default: true
🤖 Prompt for AI Agents
In @Integrations/ESPHome/Core.yaml around lines 174 - 187, The humidity offset
sensor (platform: template, name: SCD40 Humidity Offset, id:
scd40_humidity_offset) allows an excessively large range; change its min_value
and max_value to safer bounds (e.g., set min_value to -50.0 and max_value to
50.0, or -30.0/+30.0 if you prefer stricter limits) so offsets cannot produce
humidity readings outside 0–100%; keep all other properties (restore_value,
initial_value, unit_of_measurement, step, mode, disabled_by_default) unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant