Untitled

 avatar
user_6141189
yaml
2 years ago
994 B
6
Indexable
Never
esphome:
  name: esp32_bme280_oled
  platform: ESP32
  board: esp32

# Enable the BME280 sensor
sensor:
  - platform: bme280
    temperature:
      name: "Temperature"
      unit_of_measurement: "°C"
    humidity:
      name: "Humidity"
      unit_of_measurement: "%"
    pressure:
      name: "Pressure"
      unit_of_measurement: "hPa"

# Enable the OLED display
display:
  - platform: ssd1306
    name: OLED Display
    i2c_bus: 0
    reset_pin: 21
    address: 0x3C

# Display the temperature, humidity, and pressure on the OLED display
text_sensor:
  - platform: template
    lambda: |-
      return {
        "Temperature": sprintf("%.1f°C", id(temperature).state),
        "Humidity": sprintf("%.1f%%", id(humidity).state),
        "Pressure": sprintf("%.1f hPa", id(pressure).state),
      };
  - name: OLED Display Text
    update_interval: 1s
    text_sensor:
      - temperature
      - humidity
      - pressure
    display: OLED Display