esphome:
name: "esp32-tft"
friendly_name: ESP32-TFT
esp32:
board : az-delivery-devkit-v4
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxx"
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: xxx.xxx.xxx.xxx
gateway: 192.168.178.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-Fc6C48"
password: "xxx"
captive_portal:
time:
- platform: homeassistant
id: homeassistant_time
sun:
latitude: 52.2813°
longitude: 7.9534°
sensor:
# Wifi signal sensor
- platform: wifi_signal
name: wlan_signal
update_interval: 60s
unit_of_measurement: 'dBm'
internal: False
text_sensor:
- platform: homeassistant
name: "persona_da"
entity_id: device_tracker.iphone_persona
id: persona_da_weg
internal: True
- platform: homeassistant
name: "personb_da"
entity_id: device_tracker.iphone_personb
id: personb_da_weg
internal: True
- platform: homeassistant
name: "personc_da"
entity_id: device_tracker.personc
id:personc_da_weg
internal: True
- platform: homeassistant
name: "persond_da"
entity_id: device_tracker.handy_persond
id: persond_da_weg
internal: True
- platform: homeassistant
name: "persone_da"
entity_id: device_tracker.handy_persone
id: persone_da_weg
internal: True
- platform: homeassistant
name: "temp_garten"
id: temp_garten
entity_id: sensor.steckdose_flackerlampe_garten_temperature
internal: True
- platform: homeassistant
name: "sternzeichen"
id: sternzeichen
entity_id: sensor.zodiac
internal: True
- platform: sun
name: Sonnenaufgang
id: sunrise
type: sunrise
format: "%H:%M"
- platform: sun
id: sunset
name: Sonnenuntergang
type: sunset
format: "%H:%M"
font:
- file: 'fonts/arial.ttf'
id: font1
size: 36
- file: 'fonts/arial.ttf'
id: font2
size: 48
color:
- id: my_blue
red: 0%
green: 0%
blue: 100%
- id: my_green
red: 0%
green: 100%
blue: 0%
- id: my_red
red: 100%
green: 0%
blue: 0%
- id: my_yellow
red: 100%
green: 100%
blue: 0%
- id: my_orange
red: 100%
green: 50%
blue: 0%
image:
- file: "images/anwesenheit/user-green.png"
id: my_user_green
resize: 75x75
type: RGB24
- file: "images/anwesenheit/user-red.png"
id: my_user_red
resize: 75x75
type: RGB24
- file: "images/wetter/sonnenaufgang.png"
id: my_sonnenaufgang
resize: 75x75
type: RGB24
- file: "images/wetter/sonnenuntergang.png"
id: my_sonnenuntergang
resize: 75x75
type: RGB24
# Display stuff
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
display:
- platform: st7735
model: "INITR_BLACKTAB"
id: tft1
reset_pin: GPIO14
cs_pin: GPIO17
dc_pin: GPIO02
rotation: 90
device_width: 128
device_height: 160
col_start: 0
row_start: 0
eight_bit_color: True
update_interval: 5s
pages:
- id: page1
lambda: |-
it.rectangle(0, 0, 160, 128, my_blue);
it.line(0, 64, 160, 64, my_blue);
if (id(persona_da_weg).state == "home") {
it.image(20, 15, id(my_user_green));
} else {
it.image(20, 15, id(my_user_red));
}
if (id(persone_da_weg).state == "home") {
it.image(90, 15, id(my_user_green));
} else {
it.image(90, 15, id(my_user_red));
}
if (id(personb_da_weg).state == "home") {
it.image(4, 77, id(my_user_green));
} else {
it.image(4, 77, id(my_user_red));
}
if (id(personc_da_weg).state == "home") {
it.image(57, 77, id(my_user_green));
} else {
it.image(57, 77, id(my_user_red));
}
if (id(persond_da_weg).state == "home") {
it.image(109, 77, id(my_user_green));
} else {
it.image(109, 77, id(my_user_red));
}
- id: page2
lambda: |-
it.rectangle(0, 0, 160, 128, my_blue);
it.printf(80, 0, id(font2), id(my_green), TextAlign::TOP_CENTER, "Garten");
it.line(5, 50, 155, 50, my_green);
it.line(5, 51, 155, 51, my_green);
it.line(5, 52, 155, 52, my_green);
it.printf(25, 100, id(font1), id(my_red), TextAlign::BASELINE_LEFT, "%s °C", id(temp_garten).state.c_str());
- id: page3
lambda: |-
it.rectangle(0, 0, 160, 128, my_blue);
it.image(2, 2, id(my_sonnenaufgang));
it.printf(4, 120, id(font1), id(my_orange), TextAlign::BASELINE_LEFT, "%s Uhr", id(sunrise).state.c_str());
- id: page4
lambda: |-
it.rectangle(0, 0, 160, 128, my_blue);
it.image(80, 2, id(my_sonnenuntergang));
it.printf(4, 120, id(font1), id(my_orange), TextAlign::BASELINE_LEFT, "%s Uhr", id(sunset).state.c_str());
- id: page5
lambda: |-
it.rectangle(0, 0, 160, 128, my_blue);
interval:
- interval: 5s
then:
- display.page.show_next: tft1
- component.update: tft1
button:
- platform: restart
name: "Restart"