ESP32_POE_ISO thermometer code using ssd1306 display with pages and SHT31

Hello world,
Could someone please do me a solid and check my .yaml?
I’m still learning and are having trouble with using pages in the display block.


The error is:
←[32mINFO Reading configuration esp_poe_iso_sht31_pages.yaml...←[0m
←[31mERROR Error while reading config: Invalid YAML syntax. Please see YAML syntax reference or use an online YAML syntax validator:

while parsing a block collection
  in "esp_poe_iso_sht31_pages.yaml", line 48, column 7:
          - id: page1
          ^
expected <block end>, but found '<block sequence start>'
  in "esp_poe_iso_sht31_pages.yaml", line 59, column 8:
           - display.page.show_next: my_display
           ^←[0m

And the .yaml in question is…

display:
    platform: ssd1306_i2c
    model: SSD1306 128x64
    id: my_display
    #reset_pin D0
    address: 0x3C
    rotation: 0°
    pages:
      - id: page1      
        lambda: |-
          if (id(temperature).has_state()) {
            it.printf(10, 0, id(my_font), TextAlign::TOP_LEFT, "%.1f°", id(temperature).state);
          }
      - id: page2
        lambda: |-
          if (id(humidity).has_state()) {
            it.printf(10, 0, id(my_font), TextAlign::TOP_LEFT, "%.1f°", id(humidity).state);
          }
        on_...:
       - display.page.show_next: my_display
       - display.page.show_previous: my_display

     # For example cycle through pages on a timer
     interval:
       - interval: 5s
         then:
           - display.page.show_next: my_display
           - component.update: my_display

Thanks and kudos for any help1

Indentation is all wrong in those lines.

Also on_... has to be on_something

1 Like

Thanks nickrout (and Jesserockz)! here’s the working code for anyone else…

esphome:
  name: esp_poe_test
  platform: ESP32
  board: esp32-poe-iso
  
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO12
  manual_ip:
    static_ip: 10.0.0.20
    gateway: 10.0.0.139
    subnet: 255.0.0.0

i2c:
  sda: 13
  scl: 16
  scan: True
  id: bus_a
  
font:
    file: BebasNeue-Regular.ttf
    id: my_font
    size: 68
    
sensor:
    platform: sht3xd
    temperature:
      id: temperature
      name: temperature
    humidity:
      id: humidity
      name: humidity
    address: 0x45
    update_interval: 60s     

display:
    platform: ssd1306_i2c
    model: SSD1306 128x64
    id: my_display
    #reset_pin D0
    address: 0x3C
    rotation: 0°
    pages:
      - id: page1      
        lambda: |-
          if (id(temperature).has_state()) {
            it.printf(10, 0, id(my_font), TextAlign::TOP_LEFT, "%.1f°", id(temperature).state);
          }
      - id: page2
        lambda: |-
          if (id(humidity).has_state()) {
            it.printf(10, 0, id(my_font), TextAlign::TOP_LEFT, "%.1fh", id(humidity).state);
          }

# For example cycle through pages on a timer
interval:
  - interval: 5s
    then:
      - display.page.show_next: my_display
      - component.update: my_display     

web_server:
    port: 80
   
  
logger:
    level: debug 
    baud_rate: 19200
    
api:
1 Like

Just to note I changed the thread title to reflect the actual now working project