Esphome config to turn off ssd1306 OLED display with a trigger

Sure. Create a light entity and use different display pages for the on and off state. It’s even possible to change contrast (which has more or less the same effect of brightness in a ssd1306)…

light:
  - platform: monochromatic
    name: "OLED "
    output: oled_bc
    id: oled
    on_turn_on:
      then: 
      - display.page.show: page1  
      - component.update: ssd1306   #the component id which need to be updated
    on_turn_off:
      then:
      - display.page.show: page2   # a empty page....
      - component.update: ssd1306  
output:
  - platform: template
    id: oled_bc
    type: float
    write_action:
      then:
      - lambda: id(ssd1306).set_contrast(state);
3 Likes