Hi
I have a ST7735 connected to a WeMos D1 R2. I retrieve sensor data created on a BME680 ( connected to a NodeMCU in a different location ) via HomeAssistant. This part works fine.
Is there a way to turn off the screen during the night or when I’m away during the day? I do have the code to display content only at predefined times, what I’m looking for is a function for the display to actually turn it off.
I did see Ssd1306 Screen ON/OFF time based - #3 by arfrater , but it is a different type of display and it is unclear to me where it has the id’s defined for “turn_display_on” and “turn_display_off”
And I did see Turn off OLED display after boot / restart , but obviously the display for platform ST7735 does not have turn_on(), turn_off() methods.
Here is my yaml, I shortened it a bit and removed the parts related to the sensors and the lambda to print the actual values and graph
Note: if you copy the code for other purpose, the device crashes 100% with a stack trace if you connect a browser to port 80, this type of display seems to run out of memory.
esphome:
name: screen
platform: ESP8266
board: d1_mini
on_boot:
priority: -10
# ...
then:
- switch.turn_off: builtin
# Enable logging
logger:
level: INFO
# Enable Home Assistant API
api:
password: !secret api_password
ota:
password: !secret api_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: !secret ah_domain
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "screen Fallback Hotspot"
password: !secret ap_password
manual_ip:
static_ip: 192.168.0.50
gateway: 192.168.0.1
subnet: 255.255.255.0
mdns:
disabled: true
web_server:
port: 80
captive_portal:
font:
- file: "DejaVuSans.ttf"
id: my_font
size: 10
switch:
- platform: gpio
pin: D4
name: "Wemos LED"
inverted: true
id: builtin
time:
- platform: homeassistant
id: ha_time
# removed sensors
spi:
clk_pin: D5
mosi_pin: GPIO5
display:
- platform: st7735
id: display1
cs_pin: D8
dc_pin: D7
reset_pin: D6
model: INITR_BLACKTAB
rotation: 90
device_width: 128
device_height: 160
col_start: 0
row_start: 0
eight_bit_color: true
update_interval: 30s
lambda: |-
it.printf(10,10,id(my_font),blue,"Blue");
it.printf(10,25,id(my_font),green,"Green");
it.printf(10,40,id(my_font),red,"Red");
it.printf(10,55,id(my_font),yellow,"Yellow");
it.printf(10,70,id(my_font),white,"White");
regards
Armin