Add lilygo-glucose-display.yaml

This commit is contained in:
unkn committed 2026-10-19 10:17:41 +01:00
1 parent 14152a9aa8
commit cee2ff003b
1 file changed
+227
+227
View File
@@ -0,0 +1,227 @@
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:
i2c:
sda: GPIO21
scl: GPIO16
scan: false
binary_sensor:
- platform: gpio
pin: GPIO44
name: "PIR Motion Sensor"
device_class: motion
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());