Afficheur Oled des valeurs

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


wemos_oled.jpg

esphome:
name: esphome-web-b9f898
friendly_name: ESPHome retour Oled 2

esp8266:
board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
encryption:
key: "xxxxx"

ota:


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

# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-"
password: "xxxx"


###rajouté une font dans le répertoire de home assistant
font:
- file: "fonts/ArialCE.ttf"
id: my_font
size: 14



mqtt:
topic_prefix: esphome/e5406
id: mqtt_client
broker: !secret mqtt_broker
username: !secret mqtt_username
password: !secret mqtt_password

text_sensor:
- platform: mqtt_subscribe
name: "Prod"
id: Prod_sign_text
topic: domoticz/in/29
#Pzem/29
#radiateur/temp
on_value:
then:
lambda: |
id(Prod_text).publish_state(x);

- platform: mqtt_subscribe
name: "Conso"
id: Conso_sign_text
topic: domoticz/in/100
#Pzem/29
#radiateur/temp
on_value:
then:
lambda: id(Conso_text).publish_state(x);

- platform: mqtt_subscribe
name: "Ballon Temp"
id: Lixee_sign_text
topic: domoticz/in/200
#Pzem/29
#radiateur/temp
on_value:
then:
lambda: id(Lixee_text).publish_state(x);

- platform: mqtt_subscribe
name: "Dimmer Power"
id: dimmer_sign_text
topic: domoticz/in/110
on_value:
then:
lambda: id(dimmer_text).publish_state(x);

- platform: template
id: Prod_text
internal: true

- platform: template
id: Conso_text
internal: true

- platform: template
id: Lixee_text
internal: true

- platform: template
id: dimmer_text
internal: true

i2c:
sda: GPIO5
scl: GPIO4
scan: false
id: bus_a

display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: mydisplay
update_interval: 15s
lambda: |-
const char * text = id(Conso_text).state.c_str();
const char * textprod = id(Prod_text).state.c_str();
const char * textlixee = id(Lixee_text).state.c_str();
const char * textdimmer = id(dimmer_text).state.c_str();
it.printf(0, 0, id(my_font), "Conso: %s", text);
it.printf(0, 16, id(my_font), "Prod: %s", textprod);
it.printf(0, 32, id(my_font), "ECS: %s", textlixee);
it.printf(0, 48, id(my_font), "Dim: %s", textdimmer);


Revision #3
Created 29 March 2023 08:38:25 by Bernex
Updated 14 April 2023 13:16:20 by Bernex