Hi everybody out there
i’m new in ESPHome and Home Assistant though a lot to ask… about SSD1306 p.ex.
Circuit:
bme280, bh1750, ssd1306, esp8266
I can display the values on SSD1306, everything’s fine right now, just:
I read a lot, but can’t find something about switching on/off the SSD1306 via Button-Switch (here: ‘switching off’ means display.clear() ).
I want to take care of it: it only shell show the values, if i press an hold the button-switch. Leaving the button shell clear the display.
How to ?
Many thanks in advance.
Stay healthy !
So long
Here ist the yaml:
esphome:
name: esp-8266-ip50
friendly_name: WZ
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "blablub"
ota:
password: "blablub"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.178.50
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.178.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Wz Fallback Hotspot"
password: "blablub"
i2c:
sda: 4
scl: 5
scan: true
frequency: 800kHz
id: bus_a
font:
- file:
type: gfonts
family: Roboto
weight: 900
id: font2
size: 14
sensor:
- platform: bme280
temperature:
name: "Temperatur"
id: wz_temperatur
oversampling: 16x
pressure:
name: "Luftdruck"
id: wz_druck
humidity:
name: "Luftfeuchtigkeit"
id: wz_feuchte
address: 0x76
id: wz_bme280
update_interval: 60s
- platform: bh1750
name: "Lichtstärke"
id: wz_licht
address: 0x23
update_interval: 60s
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
id: wz_display
# reset_pin: -1 # Display SSD1306 has no reset-pin
address: 0x3C
lambda: |-
it.print(0, 0, id(font2), "TEMP:");
it.printf(128,0, id(font2), TextAlign::TOP_RIGHT, "%.2f°C", id(wz_temperatur).state);
it.print(0,16, id(font2), "FEUCHTE:");
it.printf(128,16, id(font2), TextAlign::TOP_RIGHT, "%.2f%%", id(wz_feuchte).state);
it.print(0,32, id(font2), "DRUCK:");
it.printf(128,32, id(font2), TextAlign::TOP_RIGHT, "%.2fhpa", id(wz_druck).state);
it.print(0,48, id(font2), "LICHT:");
it.printf(128,48, id(font2), TextAlign::TOP_RIGHT, "%.2flux", id(wz_licht).state);
update_interval: 1s
captive_portal: