diff --git a/AGENTS.md b/AGENTS.md index b8073ba..1e30203 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ Static site, **no build step** — do not add bundlers, frameworks, or npm deps - Validate registry: `python scripts/validate_registry.py` (network, ~15s); `--offline` for the shape checks alone. - `devices.json` is the single source of truth; views, scripts, and tests all read it. Device ids are lowercase-kebab and become URL hashes (`#/air-1`) and image filenames. - Every device needs `id`, `name`, `category` (hub filter pill), `description`, `image`, `wiki`, `repo`, and `firmware` (`channel -> variant -> manifest URL`), and normally `imageSource` (input to `fetch_images.py`) and `githubPagesInstaller`. `stable` is required and preferred; the first variant key is the default selection. Manifests must live on the variant's own repo's GitHub Pages site and be one of the builds that repo's classic installer page offers (the validator checks both, and that no two variants share a manifest; it can't catch two of the page's builds swapped between variants, so check the mapping by hand). Optional `config` has the same shape as `firmware` and points at the raw YAML that builds each manifest. -- Per-variant overrides in `devices.json` all follow one shape: `channel -> variant -> value`, listing only the variants that differ from the device-level field. `repos` overrides `repo`, `installers` overrides `githubPagesInstaller` (`null` hides the link), `platforms` overrides `platform`, which selects the step-3 wording: `esphome` (default), `wled`, `gameday` (the M-1's Game Day Scoreboard: Wi-Fi, then pick a team on the panel's own device page), or `standalone` (no network at all, e.g. the ornaments' Basic firmware: step 3 says there is nothing to add). `variantNotes` is the same shape but adds rather than overrides: a sentence or two under the variant toggle saying when to pick that variant. The device-level field stays the fallback, so a device that ships one ecosystem today needs no map. +- Per-variant overrides in `devices.json` all follow one shape: `channel -> variant -> value`, listing only the variants that differ from the device-level field. `repos` overrides `repo`, `installers` overrides `githubPagesInstaller` (`null` hides the link), `platforms` overrides `platform`, which selects the step-3 wording: `esphome` (default), `wled`, `gameday` (the M-1's Game Day Scoreboard: Wi-Fi, then pick a team on the panel's own device page), or `standalone` (no network at all, e.g. the ornaments' Basic firmware: step 3 says there is nothing to add). The `wled` copy's setup hotspot defaults to `Apollo `; a board whose SSID or setup differs (the MLED-1's `Apollo MLED-1 Hotspot`, the M-1's on-panel setup card) gets an entry in `WLED_SETUP` in `js/views/device.js`. `variantNotes` is the same shape but adds rather than overrides: a sentence or two under the variant toggle saying when to pick that variant. The device-level field stays the fallback, so a device that ships one ecosystem today needs no map. - **Deploy gotcha:** `.github/workflows/pages.yml` copies an explicit file list into `_site/`. Any new runtime file or directory must be added there or it 404s in production while working locally. - `vendor/esp-web-tools/` is a pinned upstream copy — never hand-edit. - Security stance: registry fields are trusted repo content (`description` and `variantNotes` are rendered as HTML); runtime-fetched content (GitHub releases, manifest-derived URLs and filenames, the URL hash) must be escaped with `esc()` or set via `textContent`, and manifest part URLs are parsed with `URL` and limited to https (see `js/views/device.js`). diff --git a/devices.json b/devices.json index 8060460..20ae1ea 100644 --- a/devices.json +++ b/devices.json @@ -334,6 +334,23 @@ } } }, + { + "id": "mled-1", + "name": "MLED-1", + "category": "LED controller", + "description": "Mini WLED controller for addressable LED strips: 5V 3A, one WAGO output", + "image": "images/mled-1.jpg", + "imageSource": "https://cdn.shopify.com/s/files/1/0792/0959/5187/files/20261102_165108.jpg?v=1793665448&height=600&crop=center", + "wiki": "https://wiki.apolloautomation.com/products/mled1/introduction/", + "platform": "wled", + "repo": "ApolloAutomation/MLED-1", + "githubPagesInstaller": "https://apolloautomation.github.io/MLED-1/", + "firmware": { + "stable": { + "WLED": "https://apolloautomation.github.io/MLED-1/firmware/manifest.json" + } + } + }, { "id": "h-1", "name": "H-1", diff --git a/images/mled-1.jpg b/images/mled-1.jpg new file mode 100644 index 0000000..1d313b2 Binary files /dev/null and b/images/mled-1.jpg differ diff --git a/js/views/device.js b/js/views/device.js index 7e5af06..2270d98 100644 --- a/js/views/device.js +++ b/js/views/device.js @@ -93,6 +93,20 @@ function platformFor(device, channel, variant) { return device.platform || 'esphome'; } +// WLED setup that differs per board; default hotspot is "Apollo ". +const WLED_SETUP = { + 'm-1': { + extra: 'On 16.0.1 the panel itself shows a setup card with that address and a QR code.', + }, + 'mled-1': { + hotspot: 'Apollo MLED-1 Hotspot', + // Shown before the Home Assistant step. + strip: `Once it is on your Wi-Fi, set it up for your strip: open its web UI at the device's IP + address, or use the WLED mobile app, and under Config → LED & Hardware set + the LED type, color order and number of LEDs to match. The strip's data line is on GPIO 13.`, + }, +}; + // Step 3 differs by what the firmware does once installed: ESPHome devices are // adopted through the ESPHome integration and Device Builder, WLED devices through // the WLED integration and the WLED web UI, the Game Day Scoreboard is set up on @@ -128,11 +142,13 @@ function stepThreeHtml(device, platform) { } const heading = '

3 Add to Home Assistant

'; if (platform === 'wled') { + const setup = WLED_SETUP[device.id] || {}; return heading + `

If you did not set Wi-Fi during install, join the open - Apollo ${device.name} Wi-Fi hotspot the device broadcasts, then open - 4.3.2.1 in a browser and pick your network. On 16.0.1 the panel itself - shows a setup card with that address and a QR code. Once it is on your Wi-Fi, go to + ${setup.hotspot || `Apollo ${device.name}`} Wi-Fi hotspot the device broadcasts, then open + 4.3.2.1 in a browser and pick your network.${setup.extra ? ` ${setup.extra}` : ''}${setup.strip ? `

+

${setup.strip}

+

Then go to` : ' Once it is on your Wi-Fi, go to'} Settings → Devices & services in Home Assistant, where it appears as a discovered WLED device. Click Configure, and you're done. ✓

diff --git a/tests/installer.spec.js b/tests/installer.spec.js index 6ddcbda..850013b 100644 --- a/tests/installer.spec.js +++ b/tests/installer.spec.js @@ -380,6 +380,32 @@ test('step 3 gives WLED instructions on a WLED device, not ESPHome ones', async await expect(done).not.toContainText('dashboard_import'); }); +test('step 3 names each WLED board\'s own hotspot and keeps the setup card M-1-only', async ({ page }) => { + const m1 = registry.devices.find((x) => x.id === 'm-1'); + const mled = registry.devices.find((x) => x.id === 'mled-1'); + test.skip(!m1 || !mled, 'needs m-1 and mled-1 in registry'); + + await page.goto('/#/m-1'); + const done = page.locator('#step-done'); + await expect(done.locator('strong').first()).toHaveText('Apollo M-1'); + await expect(done).toContainText('setup card with that address and a QR code'); + await expect(done).not.toContainText('GPIO'); + + await page.goto('/#/mled-1'); + await expect(done).toContainText('4.3.2.1'); + await expect(done.locator('strong').first()).toHaveText('Apollo MLED-1 Hotspot'); + // No display, so no setup card or QR code. + await expect(done).not.toContainText('setup card'); + await expect(done).not.toContainText('QR'); + await expect(done).toContainText('LED & Hardware'); + await expect(done).toContainText('GPIO 13'); + await expect(done).toContainText('discovered'); + // LED setup comes before "you're done". + const text = await done.innerText(); + expect(text.indexOf('LED & Hardware')).toBeLessThan(text.indexOf("you're done")); + await expect(done).not.toContainText('Take control'); +}); + test('step 3 walks a Game Day Scoreboard install through Wi-Fi and picking a team', async ({ page }) => { const d = registry.devices.find((x) => x.platforms && x.platforms.stable && Object.values(x.platforms.stable).includes('gameday'));