# Home Assistant Diabetes Display A custom, open-source continuous glucose monitor (CGM) desktop display and alarm hub 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. - **Smart Power Saving:** Integrated PIR motion sensor wakes the display when movement is detected. - **Adaptive Lighting:** BH1750 ambient light sensor automatically adjusts display backlight levels based on room lighting. - **Clock & Seconds Counter:** Displays current local time synchronized via Home Assistant. --- ## Hardware Requirements - LilyGO T-Display-S3 ESP32-S3 Display Board - BH1750 Ambient Light Sensor (I2C) - PIR Motion Sensor (GPIO 44) - USB-C cable for power and flashing --- ## Wiring Pinout | Component | Pin / Connection | | :--- | :--- | | **I2C SDA (BH1750)** | GPIO 21 | | **I2C SCL (BH1750)** | GPIO 16 | | **PIR Motion Sensor** | GPIO 44 | | **Backlight Control** | GPIO 38 | --- ## Repository Structure ```text homeassistant-diabetes/ ├── README.md ├── esphome/ │ └── lilygo-glucose-display.yaml # ESPHome device configuration ├── images/ # Required icons, arrows, and warning animations │ ├── arrow-bottom-right-thick.png │ ├── arrow-down-thick.png │ ├── arrow-right-thick.png │ ├── arrow-top-right-thick.png │ ├── arrow-up-thick.png │ ├── chevron-down.png │ ├── chevron-up.png │ └── warning.gif └── docs/ └── wiring.md # Detailed wiring and assembly notes ``` --- ## Setup & Installation Instructions ### 1. 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) creating entities for your blood glucose value and trend icon. ### 2. Clone or Download the Repository Clone this repository to your local machine or download it into your ESPHome configuration directory: ```bash git clone https://git.unknownuniverse.uk/unkn/homeassistant-diabetes.git ``` ### 3. Add Required Assets Ensure all arrow PNG files and the `warning.gif` animation are placed inside an `images/` directory relative to your ESPHome YAML configuration file, as referenced in the firmware config. ### 4. Configure Secrets In your ESPHome secrets file (`secrets.yaml`), ensure you have defined your Wi-Fi credentials: ```yaml wifi_ssid: "Your_WiFi_SSID" wifi_password: "Your_WiFi_Password" ``` ### 5. Update Entity IDs Open `esphome/lilygo-glucose-display.yaml` and verify that the Home Assistant entity IDs match your setup: - `sensor.blood_sugar_mmol` (Your blood glucose numeric sensor) - `sensor.blood_sugar_trend_icon` (Your CGM trend icon sensor) - `binary_sensor.cgm_data_fresh` (Binary sensor indicating whether data is fresh or stale) ### 6. Compile and Flash Connect your LilyGO T-Display-S3 via USB and flash the configuration using ESPHome: ```bash esphome run esphome/lilygo-glucose-display.yaml ``` --- ## License Distributed under the **MIT License**. See `LICENSE` for more information. --- [![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/theunknownuniverse) https://unknownuniverse.uk/