-
Notifications
You must be signed in to change notification settings - Fork 15
added SCD Humidity and Temp sensors #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughESPHome 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ 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. Comment |
There was a problem hiding this 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, andstate_classimproves 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
📒 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.
| - 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Version: 26.1.7.1
What does this implement/fix?
Adds SCD Temperature and SCD Humidity sensors and offsets
Types of changes
Checklist / Checklijst:
If user-visible functionality or configuration variables are added/modified:
^ I am not sure what you want here. This git repo doesn't seem to document specific sensors.
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.