Files

234 lines
5.0 KiB
YAML

esphome:
name: lilygo-glucose-display
friendly_name: LilyGO Glucose Display
spi:
type: octal
clk_pin: 8
data_pins:
- 39
- 40
- 41
- 42
- ignore_strapping_warning: true
number: 45
- ignore_strapping_warning: true
number: 46
- 47
- 48
psram:
speed: 80MHz
mode: octal
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
flash_size: 16MB
framework:
type: arduino
logger:
logs:
component: ERROR
api:
encryption:
key: "YOUR_ESPHOME_API_ENCRYPTION_KEY_HERE"
ota:
platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "LilyGO-Display-Fallback"
password: "YOUR_FALLBACK_AP_PASSWORD"
captive_portal:
# ==============================================================================
# OPTIONAL HARDWARE: Uncomment below if you have an I2C Ambient Light Sensor (BH1750)
# ==============================================================================
# i2c:
# sda: GPIO21
# scl: GPIO16
# scan: false
# ==============================================================================
# OPTIONAL HARDWARE: Uncomment below if you have a PIR Motion Sensor connected
# ==============================================================================
# binary_sensor:
# - platform: gpio
# pin: GPIO44
# name: "PIR Motion Sensor"
# device_class: motion
sensor:
# --- Optional Ambient Light Sensor ---
# - platform: bh1750
# name: "Ambient Illuminance"
# address: 0x23
# update_interval: 5s
- platform: homeassistant
id: mmol
entity_id: sensor.blood_sugar_mmol
internal: true
time:
- platform: homeassistant
id: hatime
text_sensor:
- platform: homeassistant
id: icon
entity_id: sensor.blood_sugar_trend_icon
attribute: icon
internal: true
- platform: homeassistant
id: stale
entity_id: binary_sensor.cgm_data_fresh
internal: true
output:
- platform: ledc
pin: GPIO38
id: gpio38
frequency: 2000
light:
- platform: monochromatic
output: gpio38
name: "Backlight"
restore_mode: RESTORE_DEFAULT_ON
color:
- id: orange
hex: FFAC1C
- id: grey
hex: EAEAEA
font:
- file:
type: gfonts
family: Roboto
weight: 900
id: number
size: 100
- file:
type: gfonts
family: Roboto
weight: 900
id: timefont
size: 70
- file:
type: gfonts
family: Roboto
weight: 900
id: timefontsmall
size: 45
image:
- platform: file
file: "images/arrow-bottom-right-thick.png"
id: bottomright
resize: 110x110
type: RGB
- platform: file
file: "images/arrow-down-thick.png"
id: down
resize: 110x110
type: RGB
- platform: file
file: "images/arrow-right-thick.png"
id: right
resize: 110x110
type: RGB
- platform: file
file: "images/arrow-top-right-thick.png"
id: topright
resize: 110x110
type: RGB
- platform: file
file: "images/arrow-up-thick.png"
id: up
resize: 110x110
type: RGB
- platform: file
file: "images/chevron-up.png"
id: chevup
resize: 110x110
type: RGB
- platform: file
file: "images/chevron-down.png"
id: chevdown
resize: 110x110
type: RGB
- platform: animation
file: "images/warning.gif"
id: warninggif
resize: 90x90
type: RGB
display:
- platform: mipi_spi
model: t-display-s3
id: my_display
update_interval: 1s
rotation: 270
lambda: |-
if (id(stale).state == "on") {
it.printf(4, 0, id(number), orange, "%.1f", id(mmol).state);
}
if (id(stale).state == "off") {
it.printf(4, 0, id(number), orange, "OLD");
id(warninggif).next_frame();
it.image(316, 6, id(warninggif), ImageAlign::TOP_RIGHT);
}
if ((id(icon).state == "mdi:arrow-down") and (id(stale).state == "on")) {
it.image(320, 0, id(down), ImageAlign::TOP_RIGHT);
}
if ((id(icon).state == "mdi:chevron-triple-down") and (id(stale).state == "on")) {
it.image(320, 0, id(chevdown), ImageAlign::TOP_RIGHT);
}
if ((id(icon).state == "mdi:chevron-triple-up") and (id(stale).state == "on")) {
it.image(320, 0, id(chevup), ImageAlign::TOP_RIGHT);
}
if ((id(icon).state == "mdi:arrow-up") and (id(stale).state == "on")) {
it.image(320, 0, id(up), ImageAlign::TOP_RIGHT);
}
if ((id(icon).state == "mdi:arrow-right") and (id(stale).state == "on")) {
it.image(320, 0, id(right), ImageAlign::TOP_RIGHT);
}
if ((id(icon).state == "mdi:arrow-top-right") and (id(stale).state == "on")) {
it.image(320, 0, id(topright), ImageAlign::TOP_RIGHT);
}
if ((id(icon).state == "mdi:arrow-bottom-right") and (id(stale).state == "on")) {
it.image(320, 0, id(bottomright), ImageAlign::TOP_RIGHT);
}
it.strftime(40, 100, id(timefont), grey, "%H:%M", id(hatime).now());
it.strftime(235, 115, id(timefontsmall), grey, "%S", id(hatime).now());