# Afficheur Oled des valeurs

 un wemos et un afficheur Oled, et le tout tourne sous ESPHOME   
  
connectique en GPIO 4 et 5 + GND et VCC ( mais 3.3V semble mieux )   
  
et le STL : [https://www.thingiverse.com/thing:2884823](https://www.thingiverse.com/thing:2884823)

[![wemos_oled.jpg](https://pvrouteur.apper-solaire.org/uploads/images/gallery/2023-03/scaled-1680-/wemos-oled.jpg)](https://pvrouteur.apper-solaire.org/uploads/images/gallery/2023-03/wemos-oled.jpg)

```YAML
esphome:<br></br>  name: esphome-web-b9f898<br></br>  friendly_name: ESPHome retour Oled 2<br></br><br></br>esp8266:<br></br>  board: esp01_1m<br></br><br></br># Enable logging<br></br>logger:<br></br><br></br># Enable Home Assistant API<br></br>api:<br></br>  encryption:<br></br>    key: "xxxxx"<br></br><br></br>ota:<br></br><br></br><br></br>wifi:<br></br>  ssid: !secret wifi_ssid<br></br>  password: !secret wifi_password<br></br><br></br>  # Enable fallback hotspot (captive portal) in case wifi connection fails<br></br>  ap:<br></br>    ssid: "Esphome-Web-"<br></br>    password: "xxxx"<br></br><br></br><br></br>###rajouté une font dans le répertoire de home assistant<br></br>font:<br></br>  - file: "fonts/ArialCE.ttf"<br></br>    id: my_font<br></br>    size: 14<br></br><br></br><br></br><br></br>mqtt:<br></br>  topic_prefix: esphome/e5406<br></br>  id: mqtt_client<br></br>  broker: !secret mqtt_broker<br></br>  username: !secret mqtt_username<br></br>  password: !secret mqtt_password<br></br><br></br>text_sensor:<br></br>  - platform: mqtt_subscribe<br></br>    name: "Prod"<br></br>    id: Prod_sign_text<br></br>    topic: domoticz/in/29<br></br>    #Pzem/29<br></br>    #radiateur/temp<br></br>    on_value:<br></br>      then:<br></br>        lambda: |<br></br>          id(Prod_text).publish_state(x);<br></br><br></br>  - platform: mqtt_subscribe<br></br>    name: "Conso"<br></br>    id: Conso_sign_text<br></br>    topic: domoticz/in/100<br></br>    #Pzem/29<br></br>    #radiateur/temp<br></br>    on_value:<br></br>      then:<br></br>        lambda: id(Conso_text).publish_state(x); <br></br><br></br>  - platform: mqtt_subscribe<br></br>    name: "Ballon Temp"<br></br>    id: Lixee_sign_text<br></br>    topic: domoticz/in/200<br></br>    #Pzem/29<br></br>    #radiateur/temp<br></br>    on_value:<br></br>      then:<br></br>        lambda: id(Lixee_text).publish_state(x); <br></br><br></br>  - platform: mqtt_subscribe<br></br>    name: "Dimmer Power"<br></br>    id: dimmer_sign_text<br></br>    topic: domoticz/in/110<br></br>    on_value:<br></br>      then:<br></br>        lambda: id(dimmer_text).publish_state(x); <br></br><br></br>  - platform: template<br></br>    id: Prod_text<br></br>    internal: true   <br></br><br></br>  - platform: template<br></br>    id: Conso_text<br></br>    internal: true<br></br><br></br>  - platform: template<br></br>    id: Lixee_text<br></br>    internal: true<br></br><br></br>  - platform: template<br></br>    id: dimmer_text<br></br>    internal: true<br></br><br></br>i2c:<br></br>  sda: GPIO5<br></br>  scl: GPIO4<br></br>  scan: false<br></br>  id: bus_a<br></br><br></br>display:<br></br>  - platform: ssd1306_i2c<br></br>    model: "SSD1306 128x64"<br></br>    address: 0x3C<br></br>    id: mydisplay<br></br>    update_interval: 15s<br></br>    lambda: |-<br></br>      const char * text = id(Conso_text).state.c_str();<br></br>      const char * textprod = id(Prod_text).state.c_str();<br></br>      const char * textlixee = id(Lixee_text).state.c_str();     <br></br>      const char * textdimmer = id(dimmer_text).state.c_str();<br></br>      it.printf(0, 0, id(my_font), "Conso: %s", text);<br></br>      it.printf(0, 16, id(my_font), "Prod: %s", textprod);<br></br>      it.printf(0, 32, id(my_font), "ECS: %s", textlixee);<br></br>      it.printf(0, 48, id(my_font), "Dim: %s", textdimmer);<br></br><br></br>
```