diff --git a/devices.json b/devices.json index 8060460..7835bab 100644 --- a/devices.json +++ b/devices.json @@ -427,6 +427,33 @@ "Basic (No Wi-Fi)": "standalone" } } + }, + { + "id": "pump-1-standalone", + "name": "PUMP-1 Standalone Auto Refill", + "category": "Pump", + "unlisted": true, + "description": "Refills a tank on its own: the pump starts when the lower sensor goes dry and stops when the upper sensor goes wet. Control it from its own web page; Home Assistant is optional.", + "image": "images/pump-1-standalone.jpg", + "imageSource": "https://cdn.shopify.com/s/files/1/0792/0959/5187/files/PUMP-1_WWHA_EH_and_H.jpg?v=1771963336", + "wiki": "https://wiki.apolloautomation.com/products/pump1/introduction/", + "repo": "ApolloAutomation/PUMP-1-Standalone-Installer", + "githubPagesInstaller": "https://apolloautomation.github.io/PUMP-1-Standalone-Installer/", + "firmware": { + "stable": { + "Standalone Auto Refill": "https://apolloautomation.github.io/PUMP-1-Standalone-Installer/firmware/manifest.json" + } + }, + "variantNotes": { + "stable": { + "Standalone Auto Refill": "Use Chrome or Edge and a USB-C cable that carries data. Hold the boot button while you plug the PUMP-1 in, click Connect, check Erase device, then click Install." + } + }, + "config": { + "stable": { + "Standalone Auto Refill": "https://raw.githubusercontent.com/ApolloAutomation/PUMP-1/customer/standalone-auto-refill/Integrations/ESPHome/PUMP-1_Standalone_Auto_Refill.yaml" + } + } } ] } diff --git a/images/pump-1-standalone.jpg b/images/pump-1-standalone.jpg new file mode 100644 index 0000000..378c7d6 Binary files /dev/null and b/images/pump-1-standalone.jpg differ diff --git a/js/views/hub.js b/js/views/hub.js index fad8345..9c9eb57 100644 --- a/js/views/hub.js +++ b/js/views/hub.js @@ -1,6 +1,8 @@ // js/views/hub.js — device grid with category filters export function renderHub(el, registry, missingId) { - const cats = [...new Set(registry.devices.map((d) => d.category))]; + // Unlisted devices are reachable by link only. + const listed = registry.devices.filter((d) => !d.unlisted); + const cats = [...new Set(listed.map((d) => d.category))]; el.innerHTML = `

Flash your Apollo device from the browser

@@ -12,7 +14,7 @@ export function renderHub(el, registry, missingId) { ${cats.map((c) => ``).join('')}
- ${registry.devices.map((d) => ` + ${listed.map((d) => `

${d.name}

diff --git a/scripts/test_validate_registry.py b/scripts/test_validate_registry.py index 669716a..60b898d 100644 --- a/scripts/test_validate_registry.py +++ b/scripts/test_validate_registry.py @@ -386,6 +386,11 @@ def test_missing_required_field_errors(self): errs = vr.check_device_shape(d, "x") self.assertTrue(any(repr(key) in e for e in errs), (key, errs)) + def test_unlisted_must_be_boolean(self): + self.assertEqual(vr.check_device_shape(device(unlisted=True), "msr-1"), []) + errs = vr.check_device_shape(device(unlisted="yes"), "x") + self.assertTrue(any("unlisted" in e for e in errs), errs) + def test_id_must_be_lowercase_kebab(self): for bad in ("MSR-1", "msr_1", "msr 1", "-msr", "msr--1"): errs = vr.check_device_shape(device(id=bad), "x") diff --git a/scripts/validate_registry.py b/scripts/validate_registry.py index 6e62e0f..f5ab718 100644 --- a/scripts/validate_registry.py +++ b/scripts/validate_registry.py @@ -194,6 +194,8 @@ def check_device_shape(dev, where): url = dev.get(key) if url is not None and (not isinstance(url, str) or not url.startswith("https://")): errs.append(f"{where}: {key} is not an https URL") + if "unlisted" in dev and not isinstance(dev["unlisted"], bool): + errs.append(f"{where}: unlisted must be true or false") firmware = dev.get("firmware") if not isinstance(firmware, dict) or not firmware.get("stable"): errs.append(f"{where}: no stable channel") diff --git a/tests/installer.spec.js b/tests/installer.spec.js index 6ddcbda..17e7a46 100644 --- a/tests/installer.spec.js +++ b/tests/installer.spec.js @@ -3,6 +3,7 @@ const fs = require('fs'); const path = require('path'); const registry = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'devices.json'), 'utf8')); +const listed = registry.devices.filter((d) => !d.unlisted); const manifestFor = (file, version = '1.0.0') => JSON.stringify({ name: 't', version, @@ -46,13 +47,26 @@ const noSerial = (page) => page.addInitScript(() => { Object.defineProperty(Navigator.prototype, 'serial', { get: () => undefined }); }); -test('hub renders a card for every registry device', async ({ page }) => { +test('hub renders a card for every listed registry device', async ({ page }) => { await page.goto('/'); - for (const d of registry.devices) { + for (const d of listed) { await expect(page.locator(`a.device-card[href="#/${d.id}"] h3`)).toHaveText(d.name); } }); +test('unlisted devices have no hub card but open by link', async ({ page }) => { + const hidden = registry.devices.filter((d) => d.unlisted); + test.skip(hidden.length === 0, 'no unlisted devices in the registry'); + await page.goto('/'); + await expect(page.locator('a.device-card')).toHaveCount(listed.length); + for (const d of hidden) { + await expect(page.locator(`a.device-card[href="#/${d.id}"]`)).toHaveCount(0); + await page.goto(`/#/${d.id}`); + await expect(page.locator('.device-page h1')).toHaveText(d.name); + await page.goto('/'); + } +}); + test('theme toggle is revealed once the script wires it up', async ({ page }) => { await page.goto('/'); // CSS hides .theme-btn until theme.js sets an explicit visibility; a regression @@ -65,7 +79,7 @@ test('category filter shows exactly the cards in that category', async ({ page } // Pick a category deterministically (most-populated, alphabetical tiebreak) // instead of depending on devices[0]'s position in the registry. const byCat = {}; - for (const d of registry.devices) (byCat[d.category] ||= []).push(d.id); + for (const d of listed) (byCat[d.category] ||= []).push(d.id); const cat = Object.keys(byCat) .sort((a, b) => byCat[b].length - byCat[a].length || a.localeCompare(b))[0]; const expectedIds = byCat[cat].slice().sort(); @@ -78,7 +92,7 @@ test('category filter shows exactly the cards in that category', async ({ page } expect(visibleIds).toEqual(expectedIds); await page.locator('.filters button[data-cat="all"]').click(); - await expect(page.locator('a.device-card:visible')).toHaveCount(registry.devices.length); + await expect(page.locator('a.device-card:visible')).toHaveCount(listed.length); }); test('filter pills expose aria-pressed reflecting the active filter', async ({ page }) => { @@ -558,7 +572,7 @@ test('every device and variant puts its own manifest on the install button', asy test('every hub card image loads', async ({ page }) => { await page.goto('/'); const imgs = page.locator('a.device-card img'); - await expect(imgs).toHaveCount(registry.devices.length); + await expect(imgs).toHaveCount(listed.length); for (const img of await imgs.all()) { await img.scrollIntoViewIfNeeded(); await expect.poll(() => img.evaluate((el) => el.complete && el.naturalWidth)).toBeGreaterThan(0);