# Word Clock FX | WLED 16x16 w/ ESP32
**Author:** Austin St. Aubin <austinsaintaubin@gmail.com> | **License:** MIT

A community [WLED](https://github.com/wled/WLED) usermod. It adds an **Effect** named
**"Word Clock FX"** to WLED. Because it is a regular effect (not an overlay like the older
`usermod_v2_word_clock`), it can be transitioned/crossfaded, colored, palette-mapped, and
saved per-preset like any other effect.

It shows the time in English with **exact-minute** phrasing plus the period of day, e.g.
`IT IS TWENTY ONE MINUTES PAST SEVEN IN THE EVENING`.

Word **layouts are JSON files** (`wcfx-*.json`) on the WLED filesystem, selectable in the
usermod settings. Three stock faces ship built in — the machine-validated **16×16 MK3**
(default; prints both UNTIL and TO, picked by the **Connector** setting), the original **16×16 MK1**,
and the **11×10 "WordClock 2022"** with 5-minute phrasing — and you can add your own by
uploading a file — see [Layouts](#layouts).

> **Note:** this usermod (code, settings UI, and docs) was developed with **AI assistance**
> and validated by building against WLED. Review before use and verify on your own hardware.

> **Community usermod — use at your own risk.** This is a third-party usermod and is **not**
> reviewed, tested, endorsed, or supported by the WLED project. Usermods compile into your
> firmware with full access to your device. Read the source before flashing.

> **Personal note:** this is the **MK2** build of my word clock — the second hardware revision of
> the project (the original MK1 links live under [Resources](#resources)). The repo name keeps the
> `16x16` to mark this specific build.

---

## Resources
- [Video demo (YouTube)](https://youtu.be/wZmo6SdLq88)
- [Wordclock MK1 - Twitter/X](https://x.com/AustinStAubin/status/904725600484696069)
- [Wordclock MK1 - w/ Text Shift / Rotation (Adobe Illistrator)](https://docs.google.com/spreadsheets/d/1PluM_poY26YVuXqRocmyo1mvG5tT44V26rKZcX5UzbI/edit?gid=0#gid=0)
- [Wordclock MK1 - Build Sheet](https://docs.google.com/spreadsheets/d/1UgpLxv2-_UMIiSN81n5ciU93GWFkNPKmxRbwsBQ3MRw/edit?gid=35318254#gid=35318254)
- [Wordclock MK1 (16x16) - Inventables Easel](https://easel.com/projects/LeV5aEw0NV_JYsKv2mjWpw)

## Tools
- [Reticle - Letter Grid Layout Tool](./tools/reticle.html) ([Live Preview](https://htmlpreview.github.io/?https://github.com/AustinSaintAubin/wled-usermod-word-clock-fx-16x16/blob/main/tools/reticle.html))
  - [The League of Moveable Type - BLACKOUT](https://www.theleagueofmoveabletype.com/blackout)
- Face validator — `python3 tools/wcfx_validate_run.py` checks every face that carries a
  `letters` grid, in both grammars, across all 1,440 minutes (word coverage, spelling,
  reading order, separation). Run it after any layout edit; to run it automatically on every
  firmware build, set `custom_wcfx_validate = true` in your `platformio_override.ini` (or
  one-off: `WCFX_VALIDATE=1 pio run ...`). Structural checks (bounds/schema) always run at
  build via `tools/gen_layouts.py`.
- Grammar parity test — `python3 tools/test_grammar.py` compiles the usermod's actual
  `wcfxBuildMask()` for your computer and checks it against the validator's Python model of
  the same grammar, over every face × 1,440 minutes × 4 period modes × 2 connectors × two temperature bands.
  It's what keeps the validator honest: without it, changing the C++ grammar would leave the
  validator checking the old sentence and still reporting PASS. Needs `g++`, or falls back to
  `podman run docker.io/library/gcc:14`.
- Settings-page JS check — `python3 tools/check_settings_js.py` reconstructs the JavaScript
  the usermod injects into its settings page and parses it, catching the unbalanced quote
  that would otherwise make every field render as raw text. Syntax only; still load the page
  in a browser after UI changes.
- All of these run automatically on push/PR via
  [GitHub Actions](.github/workflows/validate.yml) — no hardware needed.

## Hardware
- Controller: Wemos Lolin32 w/ SSD1306 64x128 (its what I had on-hand... recommend newer esp32 controllers)
- LED Strips: 256x + 4x WS2814 RGBW (GRB)
- Buttons: TTP223 Touch Button Module (capacitive, single-channel; "self-locking" / latching variant)
- Sensors: 
  - HTU21D BMP180 BH1750FVI 3 IN 1 Temperature Humidity Pressure Light Sensor Triad Module

---

## Layout
A 16×16 RGBW LED matrix occupies the center of the display for the word clock functionality. Outside this matrix, each corner contains a dedicated push button and a corresponding addressable RGBW LED on a seperate strip from the 16x16 matrix. (4x discrete RGBW LEDs and 4x push buttons).

▶️ [Watch the video demo (YouTube)](https://youtu.be/wZmo6SdLq88)

![display](./images/display.jpeg)
![display](./images/display-faceoff.jpeg)

### Layout MK1/MK2 (Words)

|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
| - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| I | T | K | I | S | S | T | W | E | N | T | Y | T | O | N | E |
| T | W | O | W | T | E | N | J | T | H | I | R | T | E | E | N |
| F | I | V | E | M | E | L | E | V | E | N | B | F | O | U | R |
| T | H | R | E | E | P | N | I | N | E | T | E | E | N | S | U |
| F | O | U | R | T | E | E | N | M | I | D | N | I | G | H | T |
| S | I | X | T | E | E | N | A | E | I | G | H | T | E | E | N |
| S | E | V | E | N | T | E | E | N | Y | T | W | E | L | V | E |
| M | I | N | U | T | E | S | D | Q | U | A | R | T | E | R | B |
| H | A | L | F | J | P | A | S | T | Q | U | N | T | I | L | L |
| S | E | V | E | N | T | H | R | E | E | E | L | E | V | E | N |
| E | I | G | H | T | E | N | I | N | E | T | W | E | L | V | E |
| S | I | X | F | I | V | E | F | O | U | R | T | W | O | N | E |
| Z | O | C | L | O | C | K | J | A | T | I | N | X | T | H | E |
| A | F | T | E | R | N | O | O | N | M | O | R | N | I | N | G |
| A | T | K | N | I | G | H | T | Z | E | V | E | N | I | N | G |
| & | W | A | R | M | C | O | O | L | H | O | T | C | O | L | D |

### Layout MK3 (Words)

The MK3 face is a machine-validated redesign of the MK1/MK2 layout with a **dual
connector**: both UNTIL and TO are printed on the panel, and the **Connector** setting
switches the phrasing — no reflash, no new faceplate. It carries both period-of-day
styles (MORNING/AFTERNOON/EVENING/AT NIGHT words **and** AM/PM tiles; the **Period of
day** setting picks words, AM/PM, both, or neither) plus the full temperature scale (`& COLD / COOL / WARM
/ HOT`). Every one of the 1,440 minutes of the day is verified programmatically for word
coverage, strict reading order, and lit-word separation
([`tools/wcfx_validate_run.py`](tools/wcfx_validate_run.py)). Letter economy comes from
shared-letter chains (`FIVELEVEN`, `EIGHTEN`, `SEVENINE`, `TWONE`) and embedded words
(FOUR inside FOURTEEN and the like); MIDNIGHT sits below the connectors, and the MK2
`UNTILL` typo is gone. The dark letters are not random — the panel hides KISS, PASTIMES,
ACQUARTER, ENDURE, `UNTIL TO TOO`, `OCLOCK WIND THE CAT`, the designer's initials, and a
reserved **IT IS DONE** phrase awaiting a future firmware role (full list in
[`layouts/wcfx-16x16-mk3-notes.md`](layouts/wcfx-16x16-mk3-notes.md)).

|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
| - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| I | T | K | I | S | S | T | W | E | N | T | Y | D | O | N | E |
| T | H | I | R | T | E | E | N | F | O | U | R | T | E | E | N |
| S | I | X | T | E | E | N | N | I | N | E | T | E | E | N | D |
| S | E | V | E | N | T | E | E | N | E | L | E | V | E | N | U |
| E | I | G | H | T | E | E | N | T | W | O | F | I | V | E | R |
| T | W | E | L | V | E | T | E | N | T | H | R | E | E | B | E |
| A | C | Q | U | A | R | T | E | R | H | A | L | F | A | S | A |
| M | I | N | U | T | E | S | O | P | A | S | T | I | M | E | S |
| U | N | T | I | L | B | T | O | O | F | O | U | R | S | I | X |
| F | I | V | E | L | E | V | E | N | E | I | G | H | T | E | N |
| S | E | V | E | N | I | N | E | M | I | D | N | I | G | H | T |
| T | W | E | L | V | E | T | H | R | E | E | T | W | O | N | E |
| O | C | L | O | C | K | W | I | N | D | T | H | E | C | A | T |
| N | I | G | H | T | A | M | P | M | M | O | R | N | I | N | G |
| A | F | T | E | R | N | O | O | N | E | V | E | N | I | N | G |
| & | C | O | L | D | C | O | O | L | W | A | R | M | H | O | T |


### Layout (LED IDs)
> NOTE: 16x16, serpentine.

|     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 0   | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | 10  | 11  | 12  | 13  | 14  | 15  |
| 16  | 17  | 18  | 19  | 20  | 21  | 22  | 23  | 24  | 25  | 26  | 27  | 28  | 29  | 30  | 31  |
| 32  | 33  | 34  | 35  | 36  | 37  | 38  | 39  | 40  | 41  | 42  | 43  | 44  | 45  | 46  | 47  |
| 48  | 49  | 50  | 51  | 52  | 53  | 54  | 55  | 56  | 57  | 58  | 59  | 60  | 61  | 62  | 63  |
| 64  | 65  | 66  | 67  | 68  | 69  | 70  | 71  | 72  | 73  | 74  | 75  | 76  | 77  | 78  | 79  |
| 80  | 81  | 82  | 83  | 84  | 85  | 86  | 87  | 88  | 89  | 90  | 91  | 92  | 93  | 94  | 95  |
| 96  | 97  | 98  | 99  | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 |
| 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
| 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 |
| 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 |
| 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 |
| 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 |
| 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 |
| 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 |
| 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 |
| 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 |

---

## Pin Info

Only the pins used by this build are listed; all other ESP32 GPIOs are free.

| Pin    | Used by     | Pin Notes         | Button | LED     | Location      |
| ------ | ----------- | ----------------- | ------ | ------- | ------------- |
| GPIO0  | Button      | Touch, Flash Boot | 0      |         | On Controller |
| GPIO4  | I2C         | Touch (SDA)       |        |         | OLED (opt.)   |
| GPIO5  | I2C         | SCL               |        |         | OLED (opt.)   |
| GPIO12 | Button      | Touch, Bootstrap  | 3      | 256     | Bottom Left   |
| GPIO13 | Button      | Touch             | 2      | 259     | Top Right     |
| GPIO14 | Button      | Touch             | 1      | 257     | Top Left      |
| GPIO15 | Button      | Touch             | 4      | 258     | Bottom Right  |
| GPIO25 | LED Digital | 256x WS2814       |        |         | Matrix        |
| GPIO26 | LED Digital | 4x WS2814         |        | 256-259 | Corners       |

---

## Install / Build

This is an **out-of-tree** usermod, consumed via WLED's git-URL `custom_usermods` mechanism —
you don't copy it into the WLED source tree. (It makes no changes to `wled00/` and uses the
default `USERMOD_ID_UNSPECIFIED`.) See the WLED docs:
[Writing a usermod → Share it via git URL](https://kno.wled.ge/advanced/custom-features/#writing-a-usermod).

1. Get the [WLED](https://github.com/wled/WLED) source.
2. In a `platformio_override.ini` at the WLED repo root, reference this repo by URL in your build
   environment's `custom_usermods`:
   ```ini
   custom_usermods = https://github.com/AustinSaintAubin/wled-usermod-word-clock-fx-16x16.git#main
   ```
   PlatformIO fetches it automatically — no manual copy and no git submodule needed. The `wled-`
   library name is auto-recognized as a usermod. Pin a release with `#v1.10.2` instead of `#main`
   if you prefer a fixed version. For local development you can instead point at a checkout:
   `custom_usermods = symlink:///absolute/path/to/wled-usermod-word-clock-fx-16x16`.
3. Build & flash for your ESP32 (Wemos Lolin32).

A ready-to-copy [`examples/platformio_override.sample.ini`](examples/platformio_override.sample.ini) is included
(the git-URL `custom_usermods` line, size-trim flags, optional OLED, the
`WCFX_DEFAULT_TRANSITION_MS` example, NTP/timezone, and an OTA upload env) — copy it to the WLED
repo root as `platformio_override.ini` and adjust.

An example preset set [`examples/wled_presets.example.json`](examples/wled_presets.example.json) is also included
(a "Wordclock" preset plus the per-weather presets the table maps to) — import it via WLED's
**Presets → Backup/Restore** to get a working starting point.
[`examples/wled_preset.example.json`](examples/wled_preset.example.json) is the single
"Wordclock" segment preset on its own, if you only want that one.

## Usage

1. In WLED **LED Preferences**, configure a **2D matrix** matching your build (16×16 for
   the default layout), and set the serpentine / orientation to match the physical wiring
   (the LED-ID table above is serpentine). The effect works in logical X/Y, so all wiring
   specifics are handled here, not in code.
2. Make sure the device clock is set (NTP + time zone in **Time & Macros**).
3. Select the **Word Clock FX** effect on the matrix segment.
   - **Color 1** sets the lit-word color (or pick a **palette** to spread color across
     the matrix).
   - The **Background** slider (intensity) optionally lights all letters faintly behind
     the active phrase (0 = classic all-off look).
   - Minute-to-minute changes **crossfade** using the WLED **Transition** time (the
     "Transition: x.x s" control), so words fade in/out instead of snapping. Set the
     transition to 0 for instant changes.
4. Usermod settings: `enabled` (registers the effect; reboot to apply),
   `Period of day` (`periodMode`: **Off**, **Words** — IN THE MORNING/AFTERNOON/EVENING,
   AT NIGHT — **AM/PM**, or **Both**; default Words. Words or AM/PM alone falls back to
   the other on a face that lacks it, so the 11×10 shows AM/PM under Words. Both suits
   faces where AM/PM sits apart from the period words; on MK3 the AM/PM tiles print before
   MORNING/AFTERNOON/EVENING, so it reads "IN THE PM EVENING"),
   `Connector` (`connector`: **Until** or **To** for the "to the hour" half; default Until;
   a face that prints only one uses it), the `Layout` selector below, and the temperature
   options. Upgrading from a version with the old `showPeriodOfDay` checkbox maps on → Words
   and off → Off.

### Layouts

Every word face is a **`wcfx-*.json` file in the root of the WLED filesystem**. The **Layout**
dropdown in the usermod settings lists all of them (sorted by each file's `name` field), and the
selected layout's **name renders as a clickable docs link (`↗`)** next to the dropdown, opening
the file's `link` URL. The stock faces are
**seeded at boot only if missing** — edit them freely; your in-place edits survive firmware
updates. The flip side: when an update *changes* a stock face (new names, fixed words), the
copy already on your device is **not** touched — delete the file via `/edit` and reboot, or
send `{"WordClockFx":{"reseedLayouts":true}}` to the JSON API to rewrite **all** stock files
from the firmware copies in one shot (user-named layout files are never touched):

| File | Grammar | Notes |
| ---- | ------- | ----- |
| `wcfx-16x16-mk3.json` (default) | exact minute | The MK3 face. Both connectors are printed, so the **Connector** setting picks "TEN MINUTES UNTIL EIGHT" or "TEN MINUTES TO EIGHT". Period words + AM/PM tiles + temperature words. |
| `wcfx-16x16-mk1.json` | exact minute | The original MK1/MK2 face documented above; period-of-day + temperature words. |
| `wcfx-11x10.json` | 5-minute steps | The popular [WordClock 2022](https://www.printables.com/model/311949-wordclock-2022) face; AM/PM tiles (shown for every `Period of day` setting except Off). |

Before v1.10.1 the MK3 face shipped as two files, `wcfx-16x16-mk3-until.json` and
`wcfx-16x16-mk3-to.json`. On first boot of v1.10.1 they are renamed to `….json.bak` (off the
dropdown, but any `/edit` changes are kept), and a saved selection of either moves to
`wcfx-16x16-mk3.json` — the `-to` one also sets Connector to To.

**Add your own face**: upload any `wcfx-<something>.json` via the `/edit` page (like
`ledmap.json`), then pick it in the dropdown. The stock files double as templates — the
canonical copies live in [`layouts/`](layouts/), which the firmware embeds at build time
(every `layouts/*.json` in the repo is compiled in and seeded to the device). Format:

```json
{ "name": "My 11x10", "link": "https://example.com/my-clock-docs",
  "width": 11, "height": 10, "grammar": "five",
  "letters": [ "ITLISASAMPM", "ACQUARTERDC" ],
  "words": [ ["it",0,0,2], ["is",3,0,2], ["h1",0,5,3], ["oclock",5,9,6] ] }
```

- `name` — dropdown label (falls back to the filename); `link` — optional docs URL shown as
  a clickable link in the settings and on the Info page.
- `"default": true` — marks the firmware's default/fallback face (repo layouts only; exactly
  one file may claim it, enforced at build time). Ignored on-device.
- `width`/`height` — grid size (1–32 each); `grammar` — `"five"` or `"exact"`.
- `letters` — optional array of row strings (the physical letter grid). The usermod settings
  page renders it as a live preview under the Layout dropdown, dimming filler letters that no
  word covers — handy for spotting off-by-one word coordinates. Ignored by the firmware's
  clock logic.
- Each word is `[role, x, y, len]`: 0-indexed top-left cell + run length (horizontal).
- Roles: `it is a quarter half past to until oclock minutes am pm in the at morning
  afternoon evening night and cold cool warm hot` (`and` = the `&` tile before a temperature
  word), minute numbers `m1`–`m20` (+ `m25` for a dedicated TWENTYFIVE tile), hours
  `h1`–`h12`, and `midnight` (optional tile lit instead of `TWELVE` at exactly 00:00).
  `until` is an alias of `to`; `amp` is a legacy alias of `and`. Repeating a role
  makes a multi-segment word (all segments light). Roles the grammar wants but the layout
  lacks are simply skipped.
- After editing a file, press **Reload** next to the Layout dropdown (or reboot, or send
  `{"WordClockFx":{"reloadLayout":true}}` to the JSON API). Saving the settings only re-reads
  the file when you actually picked a *different* layout — parsing one costs an 8 KB
  allocation, so it no longer happens on every unrelated save. Errors fall back to the
  built-in default face and are reported on the **Info** page; a file that won't parse at all
  is listed in the dropdown as `(bad JSON)`.

Positioning: the layout draws from the **segment's top-left**. If the word face doesn't fill
the whole matrix (e.g. an 11×10 face padded into a 12×12 matrix), frame it with the segment's
**2D start/stop bounds** — no usermod setting needed.

**5-minute grammar** floors to the last 5-minute step (10:04 still reads `TEN O'CLOCK`),
`PAST`/`TO` around the half hour, `A QUARTER` at :15/:45, `TWENTY FIVE` as TWENTY+FIVE.
**Minute dots** (Corner Buttons & LEDs section, on by default) show the floored-off 1–4 minutes
on the corner LEDs, sweeping clockwise from a corner you pick; they light on 5-minute layouts
only (an exact-minute face already says it). They can use a fixed colour or **follow the
effect's own colour/palette**.

> Upgrading from v1.3.0: the saved numeric layout setting migrates automatically, and an
> existing `/wordclock.json` custom face is renamed to `/wcfx-custom.json` at boot.

### Grammar (exact-minute layouts)
- On the hour: `IT IS <hour> O'CLOCK`
- 1–30 past: `IT IS <minutes> MINUTES PAST <hour>` (`A QUARTER PAST` at :15, `HALF PAST` at :30)
- 31–59: `IT IS <minutes> MINUTES UNTIL <next hour>` (`A QUARTER UNTIL` at :45; `TO`
  instead of `UNTIL` with Connector = To)
- Period (`Period of day` = Words or Both): `IN THE MORNING` (00–11), `IN THE AFTERNOON`
  (12–16), `IN THE EVENING` (17–20), `AT NIGHT` (21–23). `AM`/`PM` with AM/PM or Both.
- Midnight: when the layout has a `midnight` tile, exactly 00:00 reads `IT IS MIDNIGHT`
  (no `O'CLOCK`, no period words — it stands alone). Times *around* midnight deliberately say
  `... PAST TWELVE` / `... UNTIL TWELVE` instead: on the stock 16×16 face the MIDNIGHT tile
  sits above MINUTES/PAST/UNTIL, so mixed phrases would light out of reading order.
  Layouts without the tile show `TWELVE` as before.

### Grammar (5-minute layouts)
- On the step: `IT IS <hour> O'CLOCK`, `FIVE/TEN/A QUARTER/TWENTY/TWENTY FIVE PAST <hour>`,
  `HALF PAST <hour>`, then `... TO <next hour>`; minutes are **floored** to the step.
- `AM`/`PM` lights unless `Period of day` is Off (layouts with those tiles; Words falls
  back to them on a face without period words).

## Settings

![settings](./images/settings.png)

---

### Temperature words (bottom row)
When `showTemperature` is on, one of `COLD / COOL / WARM / HOT` is lit on the bottom row
(folded into the same crossfade as the time). Bands are picked by numeric thresholds:

| Word | Condition |
| ---- | --------- |
| COLD | `temp < coldBelow` |
| COOL | `coldBelow ≤ temp < coolBelow` |
| WARM | `coolBelow ≤ temp < warmBelow` |
| HOT  | `temp ≥ warmBelow` |

All temperature numbers — thresholds, `manualTemp`, and the JSON-API value — are in **°C**
(defaults 10 / 18 / 27). The `fahrenheit` option only changes how the temperature is shown
on the Info page; it does **not** change the threshold units.

When a temperature word is shown, the `&` tile (bottom-left, LED 240) lights too.

**Temperature source:** either the built-in Open-Meteo client (below), or push a live
value (°C) via the JSON API (state object):
```json
{"WordClockFx":{"temp":22.5}}
```
The live value (whichever source) is used for 30 min, then falls back to `manualTemp`.
The current temperature + weather state is shown on the WLED **Info** page.

### Weather (Open-Meteo, built in)
Turn on `fetchWeather` to pull the current outdoor temperature and condition from
[Open-Meteo](https://open-meteo.com) (free, no API key) every `fetchMinutes` (default 15,
clamped to 1–1440). Plain HTTP, so no TLS library / `lib_deps`.

Fetches happen on the render task, so a fetch that can't complete stalls the display while it
waits. Failures back off (1 → 2 → 4 → 8 → 16 min) rather than retrying every minute, and only
one blocking request is made per pass. **DNS is the one part that can't be bounded from a
usermod** — an unresolvable host can hold the clock for ~15 s per attempt regardless — so if
the display stutters periodically, check that the device's DNS actually resolves. When a fetch
has never succeeded the **Info** page says why (`never (place not found)`,
`never (cannot reach server)`, …) instead of a bare `never`.

> **HTTPS is not available on this firmware.** The WLED ESP32 framework
> (Tasmota's platform-espressif32) is built with mbedTLS **TLS disabled**
> (`CONFIG_MBEDTLS_TLS_DISABLED=y`) and ships no `WiFiClientSecure`, so a usermod cannot
> make HTTPS requests on-device. That's why Open-Meteo (which serves the API over plain
> **HTTP**) is used. HTTPS-only sources such as **NWS / api.weather.gov** can't be queried
> directly here — to use observed conditions, push them in via the JSON API from an external
> system (e.g. Home Assistant's NWS integration → `{"WordClockFx":{"temp":..}}`), or run
> a local HTTP→HTTPS proxy. (On-device HTTPS would require rebuilding the framework with TLS
> enabled.)

> **Open-Meteo accuracy:** its `weather_code` is a *forecast model* value and can disagree
> with the observed sky (e.g. report a thunderstorm on a clear day). For exact current
> conditions, use the JSON-API push noted above.

- **Location** precedence: WLED **Time settings** lat/lon (when `useWledLocation` is on *and*
  actually set) → **`place`** (city or ZIP, geocoded via Open-Meteo) → manual
  `latitude`/`longitude` (a "find lat/lon" link is provided). Because of the "actually set"
  check, a `place` still works even if `useWledLocation` is ticked but WLED's coords are 0,0.
  Open-Meteo only matches the bare city, so a `", State"` qualifier is **dropped** before
  geocoding (e.g. `Edmond, Oklahoma` → `Edmond`); use a **ZIP** if the city name is ambiguous.
- **Humidity, wind gust & condition** are shown on the WLED **Info** page alongside
  temperature (the live wind gust helps tune `windAbove`).
- **Update now:** a button in the settings (and `{"WordClockFx":{"update":true}}` via the
  JSON API) fetches the weather immediately. The Usermod settings page shows a **live status
  line** (temp / humidity / condition / location / last-updated, read from `/json/info`) that
  refreshes after you press the button, so you can see whether the fetch succeeded
  (`Updated: Xs ago`) or not (`never`, or a `not found` / `unset` location). The same info
  also appears on the main UI **Info** panel.
- **Weather → preset:** turn on `weatherPresets`, then map each weather state to a preset in
  the **table** (Weather / Preset / Test columns). Each Preset is a **dropdown** of your saved
  presets (from `/presets.json`; 0 = none). When the detected state changes, that preset is
  applied. WMO codes are grouped as:

  | State | Source | Setting |
  | ----- | ------ | ------- |
  | clear   | WMO 0, 1          | `presetClear` |
  | clouds  | WMO 2, 3          | `presetClouds` |
  | fog     | WMO 45, 48        | `presetFog` |
  | drizzle | WMO 51–55         | `presetDrizzle` |
  | rain    | WMO 61–65, 80–82  | `presetRain` |
  | snow    | WMO 71–77, 85, 86 | `presetSnow` |
  | ice     | WMO 56,57,66,67 (freezing rain/drizzle) | `presetIce` |
  | thunder | WMO 95            | `presetThunder` |
  | hail    | WMO 96, 99 (thunderstorm w/ hail) | `presetHail` |
  | heat    | temp ≥ `heatAbove` on clear/cloudy skies | `presetHeat` |
  | wind    | gust ≥ `windAbove` km/h on clear/cloudy skies | `presetWind` |
  | severe  | tornado / hurricane / tropical — **external push only** | `presetSevere` |

  `heat` and `wind` are *derived* states (Oklahoma heat waves / high wind) and only
  override otherwise calm (clear/cloudy) conditions, so storms still win. `heatAbove` is in
  **°C** (default 35); `windAbove` is wind-gust km/h (default 60).
  `severe` has no Open-Meteo source (no WMO code for tornado), so it is only reached via the
  Test picker or a JSON-API push (`{"WordClockFx":{"wxtest":12}}`) — e.g. from Home
  Assistant when a severe alert is active.

  The preset is applied on a **change** of state, and once on the **first WiFi connect after
  boot** (a few seconds after the network comes up, similar to NTP) so the current weather's
  preset is set automatically. Later reconnects refresh data but won't override a manual
  selection. A periodic re-check runs every `fetchMinutes`. The Info page also shows the
  resolved **location** and **last-updated** time; a failed fetch retries after ~1 min, and if
  data goes stale (older than 30 min) the condition shows `stale` and temperature falls back to
  `manualTemp`.

  To verify a mapping, press the **Test** button on that row — it force-applies the state's
  preset (bypassing the change-only check). The same works via the JSON API:
  `{"WordClockFx":{"wxtest":5}}` (5 = rain; 1–12 in the table order above).

### Corner buttons → corner LEDs
Lights a corner LED **while its button is held**, on top of normal **native WLED button +
preset control** (WLED still runs whatever preset/action you assign to the button — this only
adds the LED feedback, which WLED can't do natively).

Setup:
1. Configure the corner LEDs as a **second LED output** in WLED LED Preferences (e.g. 4 px on
   GPIO26 starting at index 256 → pixels 256–259), and the buttons natively in the **Button**
   setup (TTP223 = "Pushbutton (act. high)").
2. In the usermod settings, **Corner Buttons & LEDs** section:
   - A **feature table** with one row per use of the corner LEDs — `Light LED on press` and
     `Minute dots` — each with its own **On** checkbox, **Color (hex)** (`RRGGBB`, or
     `RRGGBBWW` for the W channel; a leading `#` is accepted) and **Bright (0-255)**
     (WLED's brightness scale; 255 = the colour exactly as entered, 0 = off). The two are
     independent, so you can flash a bright press over dim ambient dots.
     The dots row also has **Use FX color** — see *Minute dots* below. It's dots-only: a press
     always uses its own colour, so it still reads distinctly from the face.
   - `Dots start at` — which corner the minute dots count from (see *Minute dots* below).
   - A **corner table** with one row per corner (**Top-Left, Top-Right, Bottom-Left,
     Bottom-Right**): set each corner's **button index** (WLED button number, −1 = off) and
     **LED index** (pixel number, −1 = off). Defaults match the wiring in *Pin Info*:
     TL=btn1→LED257, TR=btn2→LED259, BL=btn3→LED256, BR=btn4→LED258.
   - Each corner row has a **Test** button that briefly (~3 s) lights the LED index currently
     in that field at **full white**, so you can confirm which physical LED maps to which
     corner before saving — regardless of the colours/brightnesses configured above. (Same as
     the JSON API: `{"WordClockFx":{"ledtest":256}}`.)

The LED is lit (via `handleOverlayDraw`, at the row's brightness and then scaled by master
brightness) only while
`isButtonPressed()` is true for that button, so momentary and self-locking touch buttons both
work; when released it returns to its normal output.

**Minute dots** (same section, **on by default**): with a 5-minute layout the words can't show
the exact minute — `Minute dots` has the corner LEDs count the remainder (`minute % 5`, so
10:07 shows `FIVE PAST TEN` + 2 dots). Dots sweep **clockwise** around the face, beginning at
the `Dots start at` corner (default Top-Left, so TL → TR → BR → BL). The sequence follows the
corner *positions*, so the corner table's LED indices remap which physical pixel each corner
is without changing the fill direction — to run counter-clockwise, swap the LED indices of the
two corners flanking your start corner (starting at Top-Left, swap the Top-Right and
Bottom-Left LED indices). Dots use the `Minute dots` colour and brightness, and only show
while the Word Clock FX effect is active **on a 5-minute layout** (they're suppressed on
exact-minute faces, which already spell the minute out). A held corner button still overrides
its dot.

Tick **Use FX color** and the dots take the running effect's own lit-word colour instead of the
hex — change the clock's colour or palette in the UI (or via a preset) and the dots follow, with
no settings edit. The hex field dims but is kept as the fallback for when you untick it.
`Bright` still applies, so dots can sit dimmer than the face. With a palette selected the
effect's colour varies across the face, so **each dot samples the palette at its own corner**
(the top dots take the start of the gradient, the bottom dots the end); with `Colors only` all
four are simply the segment's first colour. Note the dots follow the colour, not the segment's
opacity.

---

## License
MIT © Austin St. Aubin. See `SPDX-License-Identifier: MIT` in the source.
