Skip to content

[stcc4] Add driver for Sensirion STCC4 CO2 sensor#14037

Open
will-tm wants to merge 2 commits intoesphome:devfrom
will-tm:feature/stcc4-sensor
Open

[stcc4] Add driver for Sensirion STCC4 CO2 sensor#14037
will-tm wants to merge 2 commits intoesphome:devfrom
will-tm:feature/stcc4-sensor

Conversation

@will-tm
Copy link

@will-tm will-tm commented Feb 17, 2026

What does this implement/fix?

Add support for the Sensirion STCC4 miniature CO₂ sensor based on thermal conductivity measurement.

The STCC4 features a dedicated I²C controller interface for an onboard SHT4x sensor, providing
automatic temperature/humidity compensation and readings alongside CO₂ concentration. For boards
without an onboard SHT4x, external RHT compensation is supported via temperature_source and
humidity_source configuration options.

Implementation details aligned with the official Sensirion embedded driver.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Developer breaking change (an API change that could break external components)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • N/A

Pull request in esphome-docs with documentation (if applicable):

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx
  • LN882x
  • nRF52840

Example entry for config.yaml:

# With onboard SHT4x (typical eval kit / breakout board)
sensor:
  - platform: stcc4
    co2:
      name: "CO2 Concentration"
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    ambient_pressure_compensation: 1013
    update_interval: 60s


# Without onboard SHT4x (external compensation)
sensor:
  - platform: sht4x
    temperature:
      name: "Temperature"
      id: sht4x_temp
    humidity:
      name: "Humidity"
      id: sht4x_humidity

  - platform: stcc4
    co2:
      name: "CO2 Concentration"
    temperature_source: sht4x_temp
    humidity_source: sht4x_humidity
    update_interval: 60s

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@github-actions
Copy link
Contributor

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://pr#14037
    components: [stcc4]
    refresh: 1h

(Added by the PR bot)

@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.08%. Comparing base (5bb863f) to head (ae9124d).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #14037      +/-   ##
==========================================
- Coverage   74.11%   74.08%   -0.03%     
==========================================
  Files          55       55              
  Lines       11588    11588              
  Branches     1577     1577              
==========================================
- Hits         8588     8585       -3     
- Misses       2598     2600       +2     
- Partials      402      403       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments