SSD1309 display with ESPhome

I am trying to add SS1309 display to ESPhome using ESP32. I tried using this display with WLED but it only white noise on the display.
So I tired using ESPhome with following code and nothing seems to happen. OLED is not even powering up.
This is the code I am using

font:
 # gfonts://family[@weight]
  - file: "gfonts://Roboto"
    id: roboto
    size: 20
# Example configuration entry
# Example configuration entry
spi:
  clk_pin: GPIO18
  mosi_pin: GPIO23

display:
  - platform: ssd1306_spi
    model: "SSD1306 128x64"
    cs_pin: GPIO15
    dc_pin: GPIO2
    reset_pin: GPIO4
    lambda: |-
      it.print(0, 0, id(roboto), "Hello World!");
output:
  - platform: gpio
    pin: GPIO33
    id: 'generic_out'

switch:
  - platform: output
    name: "Screen Enable"
    output: 'generic_out'      

I can’t understand this code, which is referenced here.

output:
  - platform: gpio
    pin: GPIO33
    id: 'generic_out'

switch:
  - platform: output
    name: "Screen Enable"
    output: 'generic_out'

Have you tried operating the Screen Enable switch?

If you’ve not connected the module to anything yet, try adding:

    restore_mode: ALWAYS_ON

to the switch definition (docs).

I did which GPIO I should use for the switch?
I am using these pins

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO23

 cs_pin: GPIO15
    dc_pin: GPIO2
    reset_pin: GPIO4

What screen and ESP hardware do you have: link? The code in the feature request is for a specific packaging of that display.

I have 2.42 SSD1309 OLED display, pics with WLED installed


Have you gotten anywhere with getting the SSD1309 to work? I’ve got the same issue.

I was the one who created that request.

The switch is something specific for the device I have. It power the screen throght GPIO33. I don’t think this is your case.

The only difference I see between your configuration and mine is the miso pin:

spi:

  clk_pin: 18
  mosi_pin: 23
  miso_pin: 32

 

display:

  - platform: ssd1306_spi
    model: "SSD1306 128x64"
    cs_pin: 5
    dc_pin: 19
    reset_pin: 4

    lambda: |-
                  ...

Not sure if it will help.

it is working for me on esphome.