Display SSD1306 128x64 und ESP8266NodeMCU

Hallo, ich hab ein Problem, ich bekomm keine Grafik auf mein Display mit folgender config
die Ausgabe ist wie im Bild…
SDA und SCL hab ich auf D1 und D2

  
font:
  - file: "esp.ttf"
    id: esp
    size: 32
 
    
# Example configuration entry
i2c:
  sda: GPIO4
  scl: GPIO5
  # Example configuration entry





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

Hallo @HannesW,

Hast du es schon mit D1 / D2 statt Gpio als Eintrag probiert


i2c:
  sda: D1
  scl: D2

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

hab den Fehler gefunden… omg
model: “SH1106 128x64”

so jetzt steh ich weiter an, er erkennt keinen Sensor…

es steht immer nan C

font:
  - file: "arial.ttf"
    id: arialfont
    size: 15

  - file: "gfonts://Roboto"
    id: roboto
    size: 10

i2c:
  sda: GPIO5
  scl: GPIO4

sensor:
  - platform: homeassistant
    name: Boiler Temperaturen temperature 
    entity_id: sensor.boiler_temperaturen_temperature
    id: haus


display:
 
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    address: 0x3C
    lambda: |-
        it.printf(15, 15, id(arialfont),"Temper: %.1f °C", id(haus).state);
      

Zeigt er Dir im Log denn, dass die entity aus HA importiert wird?

nein leider nicht, keine Ahnung es kommt aber auch keine Fehlermeldung

API entsprechend eingerichtet und Gerät in HA integriert?

sorry welche API und was muss ich einrichten?

Du musst den

api:

Block drin haben, damit sich das Gerät überhaupt in HA meldet bzw. HA zugreifen kann.

Poste mal Deine komplette yaml für das Gerät.

ich hab das Problem sobald das Display am ESP hängt stellt mir der ESP keine Wlan Verbindung mehr her. Sobald ich das Display abschließe funktioniert alles, ich verzweifle echt.

INFO ESPHome 2023.5.5
INFO Reading configuration /config/esphome/display.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing display (board: esp01_1m; framework: arduino; platform: platformio/espressif8266@3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- ESPAsyncTCP-esphome @ 1.2.3
|   |-- Hash @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|   |-- libsodium @ 1.10018.1
|-- Wire @ 1.0
Compiling /data/display/.pioenvs/display/src/main.cpp.o
Linking /data/display/.pioenvs/display/firmware.elf
RAM:   [=====     ]  47.1% (used 38552 bytes from 81920 bytes)
Flash: [=====     ]  49.4% (used 505697 bytes from 1023984 bytes)
Building /data/display/.pioenvs/display/firmware.bin
esp8266_copy_factory_bin(["/data/display/.pioenvs/display/firmware.bin"], ["/data/display/.pioenvs/display/firmware.elf"])
========================= [SUCCESS] Took 10.75 seconds =========================
INFO Successfully compiled program.
esptool.py v4.5.1
Serial port /dev/ttyUSB1
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: bc:ff:4d:f8:0a:82
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00000000 to 0x0007cfff...
Flash params set to 0x0340
Compressed 509856 bytes to 355718...
Wrote 509856 bytes (355718 compressed) at 0x00000000 in 8.2 seconds (effective 499.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB1 with baud rate 115200
[22:12:49][I][logger:262]: Log initialized
[22:12:49][C][ota:469]: There have been 0 suspected unsuccessful boot attempts.
[22:12:49][I][app:029]: Running through setup()...
[22:12:49][I][i2c.arduino:183]: Performing I2C bus recovery
[22:12:49][C][ssd1306_i2c:010]: Setting up I2C SSD1306...
[22:12:49][C][wifi:038]: Setting up WiFi...
[22:12:49][C][wifi:039]:   Local MAC: BC:FF:4D:F8:0A:82
[22:12:49][D][wifi:387]: Starting scan...
[22:12:56][D][wifi:402]: Found networks:
[22:12:56][I][wifi:445]: - 'HaVaMESH' [redacted]▂▄▆█
[22:12:56][D][wifi:447]:     Channel: 11
[22:12:56][D][wifi:448]:     RSSI: -58 dB
[22:12:56][I][wifi:445]: - 'HaVaMESH' [redacted]▂▄▆█
[22:12:56][D][wifi:447]:     Channel: 1
[22:12:56][D][wifi:448]:     RSSI: -68 dB
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:12:56][I][wifi:258]: WiFi Connecting to 'HaVaMESH'...
[22:12:59][W][wifi_esp8266:482]: Event: Disconnected ssid='HaVaMESH' bssid=[redacted] reason='Auth Expired'
[22:12:59][W][wifi:550]: Error while connecting to network.
[22:12:59][W][wifi:586]: Restarting WiFi adapter...
[22:12:59][I][wifi:258]: WiFi Connecting to 'HaVaMESH'...
[22:13:01][W][wifi_esp8266:482]: Event: Disconnected ssid='HaVaMESH' bssid=[redacted] reason='Auth Expired'
[22:13:01][W][wifi:550]: Error while connecting to network.
[22:13:01][W][wifi:586]: Restarting WiFi adapter...
[22:13:06][D][wifi:387]: Starting scan...
[22:13:13][D][wifi:402]: Found networks:
[22:13:13][I][wifi:445]: - 'HaVaMESH' [redacted]▂▄▆█
[22:13:13][D][wifi:447]:     Channel: 1
[22:13:13][D][wifi:448]:     RSSI: -67 dB
[22:13:13][I][wifi:445]: - 'HaVaMESH' [redacted]▂▄▆█
[22:13:13][D][wifi:447]:     Channel: 11
[22:13:13][D][wifi:448]:     RSSI: -59 dB
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:13][I][wifi:258]: WiFi Connecting to 'HaVaMESH'...
[22:13:16][W][wifi_esp8266:482]: Event: Disconnected ssid='HaVaMESH' bssid=[redacted] reason='Auth Expired'
[22:13:16][W][wifi:550]: Error while connecting to network.
[22:13:16][W][wifi:586]: Restarting WiFi adapter...
[22:13:16][I][wifi:258]: WiFi Connecting to 'HaVaMESH'...
[22:13:18][W][wifi_esp8266:482]: Event: Disconnected ssid='HaVaMESH' bssid=[redacted] reason='Auth Expired'
[22:13:18][W][wifi:550]: Error while connecting to network.
[22:13:18][W][wifi:586]: Restarting WiFi adapter...
[22:13:23][D][wifi:387]: Starting scan...
[22:13:30][D][wifi:402]: Found networks:
[22:13:30][I][wifi:445]: - 'HaVaMESH' [redacted]▂▄▆█
[22:13:30][D][wifi:447]:     Channel: 11
[22:13:30][D][wifi:448]:     RSSI: -61 dB
[22:13:30][I][wifi:445]: - 'HaVaMESH' [redacted]▂▄▆█
[22:13:30][D][wifi:447]:     Channel: 1
[22:13:30][D][wifi:448]:     RSSI: -71 dB
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][D][wifi:450]: - [redacted] [redacted]▂▄▆█
[22:13:30][I][wifi:258]: WiFi Connecting to 'HaVaMESH'...
[22:13:33][W][wifi_esp8266:482]: Event: Disconnected ssid='HaVaMESH' bssid=[redacted] reason='Auth Expired'
[22:13:33][W][wifi:550]: Error while connecting to network.
[22:13:33][W][wifi:586]: Restarting WiFi adapter...
[22:13:33][I][wifi:258]: WiFi Connecting to 'HaVaMESH'...

hier die config:

esphome:
  name: display
  friendly_name: display

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "1WGdxuoPF+unwCsg6XLMISYxC/GdnLSE3EG58qq1hBk="

ota:
  password: "8f7e48b15776475a4f397b90b5eb5d6a"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Display Fallback Hotspot"
    password: "EqRxv0UnE0pb"

captive_portal:
    
font:
  - file: "arial.ttf"
    id: arialfont
    size: 15

  - file: "gfonts://Roboto"
    id: roboto
    size: 10

i2c:
  sda: GPIO5
  scl: GPIO4

sensor:
  - platform: homeassistant
    name: Boiler Temperaturen temperature 
    entity_id: sensor.solarnet_leistung_vom_netz
    id: PV


display:
 
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    address: 0x3C
    lambda: |-
        it.printf(15, 15, id(arialfont),"PV: %.1f kwH", id(PV).state);
      

Das Display funktioniert aber…

können die Displays defekt sein?

Versuch mal:

display:
 
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    address: 0x3C
    update_interval: 2s
    lambda: |-
        it.printf(15, 15, id(arialfont),"PV: %.1f kwH", id(PV).state);
2 „Gefällt mir“

ich kann es nicht glauben!! mit update_interval: 2s
verbindet er sich sofort! kannst du mir das bitte erklären? Es funktioniert!!

DANKE

Ansonsten ist der Intervall 1s und dann wird der WLAN-connect beeinflusst bzw. unterbrochen.

eine Frage noch wie kann ich 2 Seiten in einem Interval wechseln, bekomm den code nicht hin.
Danke vorraus!

Hast Du es mal mit pages und interval versucht?

esphome:
  name: display-temp
  friendly_name: Display Temp

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "paGnblEMI2TQQRsRFxc5dHThrVC7mnW12+dtZafFciI="

ota:
  password: "1c0fe19ce45597992be5c740b02e846c"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Display-Temp Fallback Hotspot"
    password: "8EPX2VSol43j"

captive_portal:

time:
  - platform: homeassistant
    id: esptime


font:
  - file: "arial.ttf"
    id: arialfont
    size: 20

  - file: "gfonts://Roboto"
    id: roboto
    size: 13

  - file: 'slkscr.ttf'
    id: font1
    size: 14

  - file: 'BebasNeue-Regular.ttf'
    id: font2
    size: 48

  - file: 'arial.ttf'
    id: font3
    size: 14

i2c:
  sda: GPIO4
  scl: GPIO5

sensor:
  - platform: homeassistant
    name: PV gesamt 
    entity_id: sensor.gesamt_pv
    id: PV

  - platform: homeassistant
    name: Netz
    entity_id: sensor.solarnet_leistung_vom_netz
    id: netz
      


  - platform: homeassistant
    id: inside_temperature
    entity_id: sensor.gw1100a_v2_2_3_indoor_temperature
    internal: true

  - platform: homeassistant
    id: outside_temperature
    entity_id: sensor.gw1100a_v2_2_3_outdoor_temperature
    internal: true
      
display:
 
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    address: 0x3C
    update_interval: 2s
    id: page1
    lambda: |-
      // Print "Mitt Smarta Hus" in top center.
      it.printf(64, 0, id(roboto), TextAlign::TOP_CENTER, "WEBER HOME");

      // Print time in HH:MM format
      it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());

      // Print inside temperature (from homeassistant sensor)
      if (id(inside_temperature).has_state()) {
        it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(inside_temperature).state);
      }

      // Print outside temperature (from homeassistant sensor)
      if (id(outside_temperature).has_state()) {
        it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1f°", id(outside_temperature).state);
      }
  

 
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    address: 0x3C
    update_interval: 2s
    id: page2
    lambda: |-
        it.printf(0, 20, id(arialfont),"Netz: %.0f W", id(netz).state);
        it.printf(0, 45, id(arialfont),"PV: %.0f W", id(PV).state);
        it.print(10, 0, id(roboto)," Weber PV-Anlage");
  

ich hab echt keine Ahnung wo ich den Code einfügen soll… sorry

Auf jeden Fall nicht das display: doppelt definieren.

Ich würde es so versuchen, mangels Display kann ich das nicht testen

  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    address: 0x3C
    update_interval: 2s
    id: disp
    pages:
      - id: page1
        lambda: |-
          DEIN CODE
      - id: page2
        lambda: |-
          DEIN CODE

interval:
  - interval: 10s
    then:
      - display.page.show_next: disp
1 „Gefällt mir“

super ! Hat geklappt! DANKE!