White display with ESPHome

I recently purchased an AirGradient DIY Pro Kit Pre-Soldered and experiencing a problem where the OLED displays a white screen with ESPHome. It worked for a few days, displaying all the sensor data then started displaying only the white screen.

Configuration:

AirGradient v3.7 (seems I should have received 4.2)
Home Assistant 2023.8.2
ESPHome: 2023.7.1

Testing:

Direct flashing through browser

  • Use AirGradient ‘flash firmware’ button
  • OLED display looks good
  • Connects to wifi and updates AirGradient dashboard

Arduino

  • Install Example: DIY_PRO_V3_7
  • OLED and wifi work as expected

Home Assistant with ESPHome

  • White OLED screen displayed
  • Tried multiple ttf fonts and size from various sites
  • Test with downloaded and online fonts
  • Remove all sensor code

Here is the yaml code I’m using after removing all the sensors, it’s very stripped and should display something on the OLED screen.

substitutions:
  devicename: "airgradient-pro"
  upper_devicename: "Airgradient Pro"

esphome:
  name: "${devicename}"
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:

api:
  encryption:
    key: "1234567890"

ota:
  password: "1234567890"

wifi:
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
  reboot_timeout: 15min
  domain: .homenet.local

  ap:
    ssid: "Airgradient Fallback Hotspot"
    password: "1234567890"

switch:
  - platform: safe_mode
    name: "Flash Mode (Safe Mode)"

captive_portal:

i2c:
  sda: D2
  scl: D1

uart:
  - rx_pin: D5
    tx_pin: D6
    baud_rate: 9600
    id: uart_1
  - rx_pin: D4
    tx_pin: D3
    baud_rate: 9600
    id: uart_2

font:
  - file: "fonts/OpenSans-Regular.ttf"
    id: opensans
    size: 16

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    reset_pin: D0
    address: 0x3C
    lambda: |-
      it.print(0, 0, id(opensans), "Hello World!");

Any ideas or suggestions would be most appreciated.

In the 2023.07 version I had some errors in the logs about things taking too long to respond, so I downgraded ESPHome to v2023.6.3 and flashed it again and then the logs showed as expected.
I didn’t check to see what the screen was doing at the time, but it could be related.

I’m using a different temp/hum sensor so my yaml woudln’t be fully helpful, but I plan on connecting the default sensors soon to make sure I have a base config yaml that could be shared with others. I know there are some out there already as well if you want to keep trying different ones, but I would try downgrading ESPHome first.

In my docker-compose file
image: esphome/esphome:2023.6.3

After research, the only way I found to downgrade ESPHome is to restore a previous snapshot.
I reverted to version 2023.6.5 that was initially installed but made no difference.

I compared my config and I didn’t see anything different in pins or config.

This is the font that I use, but I wouldn’t expect that to cause a white screen

    # Font to use on the display
    # Open Source font Liberation Sans by Red Hat
    # https://www.dafont.com/liberation-sans.font
  - file: "./fonts/liberation_sans/LiberationSans-Regular.ttf"
    id: opensans_14
    size: 14

Since it works with the Arduino code, I have to believe it is a software issue with ESPHome, but can’t say what

Just had same issue. fixed it by changing the model to “SH1106 128x64”

display:
  - platform: ssd1306_i2c
    id: oled
    address: 0x3C
    rotation: 0°
    model: "SH1106 128x64"