How to draw an icon on SSD1306 OLED

I’m trying to display my solar power essentials on a tiny 64x48 display and would like to use icons in stead of text to save space.

The OLED display: OLED 0.66 Shield — WEMOS documentation

The Icon I would like to use is this one: battery - Material Design Icons - Pictogrammers

Here’s my code:

substitutions:
  name: "esphome-micro-display"
  friendly_name: ESPHome Micro Display

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'

esp8266:
  board: d1_mini



dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp8266.yaml@main
  import_full_config: true

i2c:
  scl: D1
  sda: D2


font:
  - file: "gfonts://B612 Mono"
    id: font_small
    size: 10
  - file: "gfonts://Reddit Mono"
    id: font_mono_medium
    size: 14

sensor:
  - platform: homeassistant
    id: soc
    entity_id: sensor.deye_sunsynk_sol_ark_battery_state_of_charge
    internal: true
  - platform: homeassistant
    id: load
    entity_id: sensor.deye_sunsynk_sol_ark_load_power
    internal: true

time:
  - platform: homeassistant
    id: esptime

display:
  - platform: ssd1306_i2c
    model: "SSD1306 64x48"
    reset_pin: 0
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(font_small), "BATT:%.0f%%", id(soc).state);
      it.printf(0, 15, id(font_small), "LOAD:%.1f%KW", id(load).state/1000.0);

If you have read the relevant docs accessible from the 1st and 2nd result of google search, It would be painfully obvious that you have missed the image part from your configs.

1 Like

Thanks, I was so confused reading arduino source code trying to refactor it for esphome and between chatgpt I was getting nowhere. You’re right it’s simply in the ESPHome display documentation. Thanks for answering.