Configurer un 0,96 Zoll Oled Display

Mon problème

Bonjour,
j’essaie de configurer un 0,96 Zoll Oled connecté a un esp32S avec ESPHOME,
Renseigner votre problème

Ma configuration


System Information

version core-2023.4.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.10
os_name Linux
os_version 5.15.84-v8
arch aarch64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.31.0
Stage running
Available Repositories 1319
Downloaded Repositories 8
HACS Data ok
Home Assistant Cloud
logged_in true
subscription_expiration 6 mars 2024 à 01:00
relayer_connected true
relayer_region eu-central-1
remote_enabled true
remote_connected true
alexa_enabled false
google_enabled false
remote_server eu-central-1-3.ui.nabu.casa
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 9.5
update_channel stable
supervisor_version supervisor-2023.04.0
agent_version 1.4.1
docker_version 20.10.22
disk_total 219.4 GB
disk_used 5.9 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons File editor (5.5.0), Terminal & SSH (9.6.1), Mosquitto broker (6.2.0), Zigbee2MQTT (1.30.3-1), Samba share (10.0.0), ESPHome (2023.3.2)
Dashboards
dashboards 1
resources 2
views 4
mode storage
Recorder
oldest_recorder_run 24 mars 2023 à 07:13
current_recorder_run 10 avril 2023 à 12:21
estimated_db_size 17.62 MiB
database_engine sqlite
database_version 3.38.5
Mon fichier yaml: ``` esphome: name: esphome-web-a21470 friendly_name: ESPHome Web a21470

esp32:
board: esp32dev
framework:
type: arduino

Enable logging

logger:

Enable Home Assistant API

api:
encryption:
key: "

ota:

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

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: « Esphome-Web-A21470 »
password: « xHhiE9ucYXrA »

captive_portal:

Example configuration entry

sensor:

  • platform: dht
    pin: 16
    temperature:
    name: « ESP32 Temperature »
    humidity:
    name: « ESP32Room Humidity »
    update_interval: 30s

Example configuration entry

light:

  • platform: binary
    name: « Desk Lamp »
    output: light_output

output:

  • id: light_output
    platform: gpio
    pin: GPIO4

time:

  • platform: homeassistant
    id: esptime

#----------------------------------------------------------------------------------------------------------
i2c:
sda: 21
scl: 22

display:

  • platform: ssd1306_i2c
    model: « SSD1306 128x64 »
    #reset_pin: D0
    address: 0x3C
    lambda: |-
    it.print(0, 0, id(font), « Hello World! »);
L'erreur lors de l'install:

[floatl]INFO Reading configuration /config/esphome/esphome-web-a21470.yaml...
WARNING GPIO4 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Detected timezone 'Europe/Paris'
Failed config

display.ssd1306_i2c: [source /config/esphome/esphome-web-a21470.yaml:66]
  platform: ssd1306_i2c
  model: SSD1306_128X64
  address: 0x3C
  
  Couldn't find ID 'font'. Please check you have defined an ID with that name in your configuration.
  lambda: !lambda |-
    it.print(0, 0, id(font), "Hello World!");
  auto_clear_enabled: True
  brightness: 1.0
  contrast: 1.0
  flip_x: True
  flip_y: True
  offset_x: 0
  offset_y: 0
  invert: False
  update_interval: 1s[/floatl]

Bonjour,
copie ton programme en mode programme car là on ne voit pas les problèmes de syntaxe et d’indentation
et donc ça me semble difficile de te répondre même si je ne suis pas expert!
Cordialement

i2c:
  sda: 21
  scl: 22


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

Bonjour problème de câblage de ton esp et pas du prog :

[floatl]INFO Reading configuration /config/esphome/esphome-web-a21470.yaml...
WARNING GPIO4 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Detected timezone 'Europe/Paris'
Failed config

Bonjour a tous ,
J’ai solutionné mon problème. Je mets la configuration de mon yaml au cas ou cela intéresserai quelqu’un

# Example configuration entry
light:
  - platform: binary
    name: "Desk Lamp"
    output: light_output

output:
  - id: light_output
    platform: gpio
    pin: GPIO16   
#Get Time
time:
  - platform: homeassistant
    id: esptime
# Example configuration entry
sensor:
  - platform: dht
    pin: 17    
    temperature:
      name: temperature
      id: temp
    humidity:
      name: humidity
      id: hum
    update_interval: 30s
# Example configuration entry
i2c:
  sda: 21
  scl: 22
  scan: false
font:
  - file: "gfonts://Roboto"
    id: roboto1
    size: 8
  - file: "gfonts://Roboto"
    id: roboto2
    size: 30 
  - file: "gfonts://Roboto"
    id: roboto3
    size: 14



display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      // Print "Mitt Smarta Hus" in top center.
      it.printf(64, 0, id(roboto3), TextAlign::TOP_CENTER, "Lumbin");

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

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

      // Print outside temperature (from homeassistant sensor)
      if (id(hum).has_state()) {
        it.printf(127, 60, id(roboto3), TextAlign::BASELINE_RIGHT , "%.1f°", id(hum).state);
      }saisissez ou collez du code ici

J’ai sur mon breadbord un NodeMCU ESP32 kit un capteur température et humidité DHT22 ,un display 0.96 Oled et j’ai ajouté une Led que je peux allumer ou éteindre depuis le tableau de bord de HA
Merci d’avoir pris le temps de me lire et de me répondre

1 « J'aime »