71 lines
2.5 KiB
Markdown
71 lines
2.5 KiB
Markdown
# Home Assistant - ESP Home - LilyGo Diabetes Display
|
|
|
|
A custom, open-source continuous glucose monitor (CGM) desktop display powered by a **LilyGO T-Display-S3** running **ESPHome**, integrated directly with **Home Assistant**.
|
|
|
|
## Features
|
|
|
|
- **Real-Time Glucose Display:** Shows current blood glucose readings (in mmol/L) with trend arrows.
|
|
- **Data Freshness Warning:** Automatically detects if CGM data becomes stale and displays an "OLD" warning with an animated alert icon.
|
|
- **Clock & Seconds Counter:** Displays current local time synchronized via Home Assistant.
|
|
|
|
---
|
|
|
|
## Hardware Requirements
|
|
|
|
- LilyGO T-Display-S3 ESP32-S3 Display Board
|
|
- USB-C cable for power and flashing
|
|
|
|
---
|
|
|
|
## Home Assistant Prerequisites
|
|
|
|
- A working **Home Assistant** instance with the **ESPHome** integration installed.
|
|
- A CGM data source feeding into Home Assistant (e.g., Nightscout, xDrip+, or LibreLinkUp integration).
|
|
- The following Home Assistant entities:
|
|
- Numeric sensor for your blood glucose levels (`sensor.blood_sugar_mmol`)
|
|
- Text/attribute sensor supplying the MDI trend icon (`sensor.blood_sugar_trend_icon`)
|
|
- Binary sensor that evaluates to `on` when data is fresh and `off` when stale (see below).
|
|
|
|
### Creating the Staleness Binary Sensor in Home Assistant
|
|
If you are using Home Assistant template helpers to check if your CGM data is fresh (e.g., updated within the last 15 minutes / 900 seconds), you can create a template binary sensor using this logic:
|
|
|
|
```jinja2
|
|
{% if states.sensor.blood_sugar_mmol_dc.last_updated %}
|
|
{% set last_updated = as_timestamp(states.sensor.blood_sugar_mmol_dc.last_updated) %}
|
|
{% set current_time = as_timestamp(now()) %}
|
|
{% if current_time - last_updated <= 900 %}
|
|
on
|
|
{% else %}
|
|
off
|
|
{% endif %}
|
|
{% else %}
|
|
off
|
|
{% endif %}
|
|
```
|
|
|
|
---
|
|
|
|
## Setup & Installation
|
|
|
|
### 1. Add Required Assets
|
|
Ensure all PNG and GIF files are placed inside the `/homeassistant/esphome/images` directory.
|
|
|
|
### 2. Configure Secrets
|
|
In your ESPHome secrets file (`/homeassistant/esphome/secrets.yaml`), ensure you have defined your Wi-Fi credentials:
|
|
```yaml
|
|
wifi_ssid: "Your_WiFi_SSID"
|
|
wifi_password: "Your_WiFi_Password"
|
|
```
|
|
|
|
### 3. Compile and Flash
|
|
Connect your LilyGO T-Display-S3 via USB and flash the configuration using ESPHome:
|
|
- Create device
|
|
- Advanced set up options
|
|
- Either select "Import from file" (`lilygo-glucose-display.yaml`) or "Empty Configuration" where you can copy/paste the YAML code.
|
|
|
|
---
|
|
|
|
[](https://ko-fi.com/theunknownuniverse)
|
|
|
|
[The Unknown Universe](https://unknownuniverse.uk/)
|