From 5d5e51c2f670a69c4acab48a55be2946ba7aee39 Mon Sep 17 00:00:00 2001 From: unkn <1+unkn@noreply.localhost> Date: Mon, 19 Oct 2026 10:59:04 +0100 Subject: [PATCH] Update README.md --- README.md | 64 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index bfe15c4..2784de9 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ A custom, open-source continuous glucose monitor (CGM) desktop display powered b ## Features -- **Real-Time Glucose Display:A CGM data source feeding into Home Assistant (e.g., Nightscout, xDrip+, or LibreLinkUp integr** Shows current blood glucose readings (in mmol/L) with trend arrows. +- **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 @@ -16,49 +17,54 @@ A custom, open-source continuous glucose monitor (CGM) desktop display powered b --- -## Setup & Installation Instructions +## Home Assistant Prerequisites -### 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. +- A CGM data source feeding into Home Assistant (e.g., Nightscout, xDrip+, or LibreLinkUp integration). - The following Home Assistant entities: - - Numeric sensor for you 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. + - 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). -### 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 +### 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 %} ``` -### 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: +## 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" ``` -### 5. 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 +### 3. 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 -``` - - -
+- 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. --- [![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/theunknownuniverse) -https://unknownuniverse.uk/ +[The Unknown Universe](https://unknownuniverse.uk/)