跳转到内容

BME680 温度+压力+湿度+气体传感器

bme680 传感器平台允许您在 ESPHome 中使用 BME680 (数据手册, Adafruit)温度、压力和湿度传感器。需要在您的配置中设置 I²C 才能使此传感器正常工作。

BME680 温度、压力与湿度传感器。
# Example configuration entry
sensor:
- platform: bme680
temperature:
name: "BME680 Temperature"
oversampling: 16x
pressure:
name: "BME680 Pressure"
humidity:
name: "BME680 Humidity"
gas_resistance:
name: "BME680 Gas Resistance"
address: 0x77
update_interval: 60s
  • temperature (可选): 温度传感器的信息。

    • oversampling (可选): 温度传感器的过采样参数。 请参阅 过采样选项。

    • 来自 Sensor 的所有其他选项。

  • pressure (可选): 压力传感器的信息。

    • oversampling (可选): 温度传感器的过采样参数。 请参阅 过采样选项。

    • 来自 Sensor 的所有其他选项。

  • humidity (可选): 湿度传感器的信息。

    • oversampling (可选): 温度传感器的过采样参数。 请参阅 过采样选项。

    • 来自 Sensor 的所有其他选项。

  • gas_resistance (可选): 气体传感器的信息。

    • 来自 Sensor 的所有选项。
  • address (可选, int): 手动指定传感器的 I²C 地址。默认为 0x76。另一个地址可以是 0x77。

  • iir_filter (可选): 设置无限脉冲响应滤波器以提高精度。可选值为 OFF、1x、3x、7x、15x、31x、63x 和 127x。默认为 OFF。

  • heater (可选): 气体传感器内部加热器的设置。设置此项 可禁用内部加热器。

    • temperature (可选, int): 加热器的目标温度,在 200 到 400 °C 之间。 默认为 320。

    • duration (可选, Time): 加热器应保持活动的时间。最大值为 4032ms。 默认为 150ms。

  • update_interval (可选, Time): 检查传感器的时间间隔。默认为 60s。

默认情况下,BME680 传感器在请求新值时会对每个值测量 16 次。但是,您可以 配置此数量。可能的过采样值:

  • NONE(跳过该值)
  • 1x
  • 2x
  • 4x
  • 8x
  • 16x(默认)

添加室内空气质量(IAQ)计算和 IAQ 标签,基于 BME680 BSEC 组件 索引中的值。

# Example configuration entry
sensor:
- platform: bme680
temperature:
name: "BME680 Temperature"
oversampling: 16x
pressure:
name: "BME680 Pressure"
humidity:
id: "humidity"
name: "BME680 Humidity"
gas_resistance:
id: "gas_resistance"
name: "BME680 Gas Resistance"
address: 0x77
update_interval: 60s
- platform: template
name: "BME680 Indoor Air Quality"
id: iaq
icon: "mdi:gauge"
# calculation: comp_gas = log(R_gas[ohm]) + 0.04 log(Ohm)/%rh * hum[%rh]
lambda: |-
return log(id(gas_resistance).get_state()) + 0.04 * id(humidity).get_state();
state_class: "measurement"
text_sensor:
- platform: template
name: "BME680 IAQ Classification"
icon: "mdi:checkbox-marked-circle-outline"
lambda: |-
if (int(id(iaq).get_state()) <= 50) {
return {"Excellent"};
}
else if (int(id(iaq).get_state()) <= 100) {
return {"Good"};
}
else if (int(id(iaq).get_state()) <= 150) {
return {"Lightly polluted"};
}
else if (int(id(iaq).get_state()) <= 200) {
return {"Moderately polluted"};
}
else if (int(id(iaq).get_state()) <= 250) {
return {"Heavily polluted"};
}
else if (int(id(iaq).get_state()) <= 350) {
return {"Severely polluted"};
}
else if (int(id(iaq).get_state()) <= 500) {
return {"Extremely polluted"};
}
else {
return {"unknown"};
}