ESPHome custom/external components for Winsen electrochemical carbon monoxide (CO) sensors.
π’ NB: Examples of using uart debug and commands directly in yaml (without custom components) are available in the example folder.
Sensor | Range | Status | Component |
---|---|---|---|
ZE15-CO | 0-500 ppm | β Ready | ze15_co |
ZE07-CO | 0-500 ppm | β Ready | ze07_co |
- π Carbon Monoxide (CO) measurement in ppm
- π Automatic mode selection based on configuration (ZE15-CO)
- π Dual mode support for ZE07-CO (Passive/Q&A modes)
- π¨ Sensor fault detection (ZE15-CO only)
- π Home Assistant integration ready
- π‘ UART communication at 9600 baud
- π― High precision: 0.1 ppm resolution
- π Power efficient Q&A mode with dormant support (ZE07-CO)
external_components:
- source: github://Bjk8kds/esphome-winsen-co-sensor
components: [ ze15_co, ze07_co ]
- Copy the
components/ze15_co
orcomponents/ze07_co
folder to your ESPHome configuration directory - Use the component in your YAML configuration
ZE15-CO Pin | ESP32 Pin | Function |
---|---|---|
PIN 15 | 5V | Power Supply (5-12V DC) |
PIN 5, 14 | GND | Ground |
PIN 8 | GPIO16 | TX β ESP RX |
PIN 7 | GPIO17 | RX β ESP TX (for Q&A mode) |
ZE07-CO Pin | ESP32 Pin | Function |
---|---|---|
PIN 15 | 5V | Power Supply (5-12V DC) |
PIN 5, 14 | GND | Ground |
PIN 8 | GPIO16 | TX β ESP RX |
PIN 7 | GPIO17 | RX β ESP TX (required for Q&A mode) |
β οΈ Note: ESP TX to sensor RX connection is only required for Q&A mode
The component automatically selects the operating mode based on your configuration:
No update_interval
= Receives data every second
# UART Configuration
uart:
rx_pin: GPIO16 # Required
tx_pin: GPIO17 # Optional for Initiative mode
baud_rate: 9600
# Sensor Configuration
sensor:
- platform: ze15_co
co:
name: "Carbon Monoxide"
With update_interval
= Requests data at specified intervals
# UART Configuration
uart:
rx_pin: GPIO16 # Required
tx_pin: GPIO17 # Required for Q&A mode
baud_rate: 9600
# Sensor Configuration
sensor:
- platform: ze15_co
update_interval: 60s # Minimum 5s, enables Q&A mode
co:
name: "Carbon Monoxide"
sensor_fault:
name: "CO Sensor Fault"
ZE07-CO requires explicit mode selection and supports power-saving dormant mode:
sensor:
- platform: ze07_co
mode: PASSIVE # Continuous data every second
co:
name: "CO Level"
sensor:
- platform: ze07_co
mode: QA # Power efficient mode
update_interval: 60s # Minimum 45s, default 60s
co:
name: "CO Level"
Parameter | Type | Default | Description |
---|---|---|---|
update_interval |
time | - | If set (β₯5s): Q&A mode If not set: Initiative mode |
co |
sensor | - | CO concentration sensor |
sensor_fault |
binary_sensor | - | Sensor fault detection |
uart_id |
id | - | UART bus ID |
Parameter | Type | Default | Description |
---|---|---|---|
mode |
string | PASSIVE |
Operating mode: PASSIVE or QA |
update_interval |
time | 60s |
Update interval for Q&A mode (β₯45s) |
co |
sensor | - | CO concentration sensor |
uart_id |
id | - | UART bus ID |
Feature | ZE15-CO | ZE07-CO |
---|---|---|
Mode Selection | Automatic (based on update_interval ) |
Explicit (mode parameter) |
Initiative/Passive Mode | β Real-time data | β Real-time data |
Q&A Mode | β Simple request/response | β With dormant support |
Dormant Mode | β Always active | β Power saving between readings |
Sensor Fault Detection | β Available | β Not available |
Min Q&A Interval | 5 seconds | 45 seconds |
Warm-up Time | 30 seconds | 3 minutes |
# ZE15-CO - Real-time monitoring
sensor:
- platform: ze15_co
co:
name: "CO Level"
# ZE07-CO - Real-time monitoring
sensor:
- platform: ze07_co
co:
name: "CO Level"
# ZE15-CO - Q&A mode (sensor always active)
sensor:
- platform: ze15_co
update_interval: 60s
co:
name: "CO Level"
sensor_fault:
name: "CO Sensor Status"
# ZE07-CO - Q&A mode with dormant (extends sensor life)
sensor:
- platform: ze07_co
mode: QA
update_interval: 5min # Battery friendly
co:
name: "CO Level"
sensor:
- platform: ze15_co
co:
name: "Indoor CO"
id: co_indoor
on_value_range:
- above: 30
then:
- logger.log:
level: WARN
format: "CO level elevated: %.1f ppm"
args: ['x']
- above: 50
then:
- logger.log:
level: ERROR
format: "DANGER! CO level: %.1f ppm"
args: ['x']
binary_sensor:
- platform: template
name: "CO Alarm"
lambda: |-
return id(co_indoor).state > 50;
device_class: gas
CO Level (ppm) | Health Effects | Action Required |
---|---|---|
0-9 | Normal background | None |
10-29 | Typical indoor levels | Monitor |
30-49 | Potential health effects | Increase ventilation |
50-99 | Dangerous | Evacuate & ventilate |
100+ | Life-threatening | Immediate evacuation |
- Check power supply (5-12V)
- Verify UART connections
- Ensure 9600 baud rate
- Allow sensor warm-up time (30s for ZE15-CO, 3min for ZE07-CO)
- ZE15-CO: Check if
update_interval
is set correctly - ZE07-CO: Verify
mode
parameter and TX connection for Q&A mode
logger:
level: DEBUG
logs:
ze15_co: VERY_VERBOSE
ze07_co: VERY_VERBOSE
Contributions welcome! Especially for:
- Additional Winsen CO sensors
- Performance optimizations
- Documentation improvements
MIT License - see LICENSE file for details.
- ESPHome development team
- Winsen Electronics for sensor documentation
- Community contributors
- π ESPHome Documentation
- π¬ Home Assistant Community
- π Issue Tracker
Made with β€οΈ for the ESPHome community