Preciso de ajuda para navegar entre os displays com os botões, e em seguida quero adicionar um led nele, não consegui encontrar muita coisa sobre isso.
substitutions:
esphome_name: esp32_ssd1306
esphome:
name: "${esphome_name}"
friendly_name: Esp1
esp32:
board: esp32dev
framework:
type: arduino
logger:
api:
encryption:
key: "74DyYNMsRqP/KnbCC90/nsbUfpHdx/8ruhphmCaX1Js="
ota:
password: "4c2bc4519a2c8d18c96b7765303be11b"
wifi:
ssid: "SINAL"
password: "22221313"
ap:
ssid: "Esp1 Fallback Hotspot"
password: "WBd6JI5tBEzO"
captive_portal:
i2c:
- id: bus_a
sda: 21
scl: 22
scan: true
sensor:
- platform: dht
pin: GPIO13
model: dht11
temperature:
name: "office_temperature"
id: office_temperature
humidity:
name: "office_humidity"
id: office_humidity
update_interval: 20s
- platform: bmp280
temperature:
name: "Outside Temperature"
id: outside_temperature
oversampling: 16x
pressure:
name: "Outside Pressure"
id: outside_pressure
address: 0x76
- platform: uptime
name: "${esphome_name} - Uptime Sensor"
- platform: wifi_signal
name: "${esphome_name} - WiFi Signal"
update_interval: 60s
binary_sensor:
- platform: gpio
name: "Button 1"
internal: true
pin:
number: GPIO4
mode: INPUT_PULLUP
on_press:
- lambda: id(display1).turn_on();
- delay: 2s
- lambda: id(display1).turn_off();
- platform: gpio
name: "Button 2"
internal: true
pin:
number: GPIO2
mode: INPUT_PULLUP
on_press:
- lambda: id(display2).turn_on();
- delay: 2s
- lambda: id(display2).turn_off();
- platform: gpio
name: "Button 3"
internal: true
pin:
number: GPIO15
mode: INPUT_PULLUP
on_press:
- lambda: id(display3).turn_on();
- delay: 2s
- lambda: id(display3).turn_off();
- platform: gpio
name: "Button 4"
internal: true
pin:
number: GPIO12
mode: INPUT_PULLUP
on_press:
- lambda: id(display4).turn_on();
- delay: 2s
- lambda: id(display4).turn_off();
- platform: gpio
name: "Button 5"
internal: true
pin:
number: GPIO14
mode: INPUT_PULLUP
on_press:
- lambda: id(display5).turn_on();
- delay: 2s
- lambda: id(display5).turn_off();
font:
- file: "/config/esphome/Arial.ttf"
id: my_font
size: 13
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: "display1"
lambda: |-
it.printf(0, 16, id(my_font), "Acqua Callidus");
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: "display2"
lambda: |-
it.printf(0, 0, id(my_font), "Botão 3 - Umidade");
it.printf(0, 16, id(my_font), "Botão 4 - Pressão");
it.printf(0, 32, id(my_font), "Botão 5 - Temperatura");
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: "display3"
lambda: |-
it.printf(0, 16, id(my_font), "Humidity: %.2f%%", id(office_humidity).state);
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: "display4"
lambda: |-
it.printf(0, 32, id(my_font), "Pressure: %.2fhPa", id(outside_pressure).state);
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: "display5"
lambda: |-
it.printf(0, 0, id(my_font), "Temperature: %.2f°C", id(office_temperature).state);
switch:
- platform: template
name: "${esphome_name} - Onboard LED"
id: onboard_led
turn_on_action:
- logger.log: "LED Ligado"
turn_off_action:
- logger.log: "LED Desligado"