Untitled

 avatar
user_6141189
yaml
2 years ago
1.4 kB
6
Indexable
Never
esphome:
  name: esp32_lcd
  platform: ESP32
  board: esp32

# Enable the I2C bus and the LCD display
i2c:
  sda: 21
  scl: 22

display:
  - platform: i2c_lcd1602
    name: LCD Display
    i2c_id: i2c
    reset_pin: 16
    rows: 2
    cols: 16

# Create a page for displaying the temperature, humidity, and pressure
lcd_page:
  - name: "Environment"
    template: |
      {%- if humidity is defined -%}
      Humidity: {{ humidity.state }}%
      {%- endif -%}
      {%- if temperature is defined -%}
      Temperature: {{ temperature.state }}°C
      {%- endif -%}
      {%- if pressure is defined -%}
      Pressure: {{ pressure.state }} hPa
      {%- endif -%}

# Create a page for displaying the uptime of the device
lcd_page:
  - name: "Uptime"
    template: |
      Uptime: {{ uptime.hours }}h {{ uptime.minutes }}m {{ uptime.seconds }}s

# 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 uptime sensor
uptime:
  name: "Uptime"
  update_interval: 60s

# Display the pages on the LCD display
lcd_text:
  - display: LCD Display
    lcd_page:
      - Environment
      - Uptime