feat: read-only device list endpoint + PWA section (#52) - #59
Open
mdj2812-hephaestus[bot] wants to merge 1 commit into
Open
feat: read-only device list endpoint + PWA section (#52)#59mdj2812-hephaestus[bot] wants to merge 1 commit into
mdj2812-hephaestus[bot] wants to merge 1 commit into
Conversation
GET /devices (Docker) and GET /api/home_intercom/devices (both targets) return the device registry snapshot: name, bound room, last_seen, firmware_version, revoked — keyed by MAC. Auth follows the existing split: the HA view is gated by the PWA shared token (same as RecordView — device names/MACs are the registry's only auth material, so unlike /rooms this isn't public); the Docker route stays LAN-open, same trust model as /record. Payload built by shared devices_payload() so both sides stay identical. PWA: a read-only 'Intercom Buttons' section under the room grid lists each button (name, room, firmware · last seen; revoked rows struck through). It stays hidden when the registry is empty or the endpoint is unavailable, renders via textContent only, and re-renders on language switch through a renderDevices hook in i18n.js. Tests: DevicesView unit tests (token gate, payload, no-store), Docker route tests (empty/registered/HA alias, isolated store), and smoke checks on both targets — Docker asserts the hello-registered MAC shows up; HA extracts the token from .storage and asserts 401-without + 200-with.
mdj2812-hephaestus
Bot
force-pushed
the
feat/pwa-device-list
branch
from
July 24, 2026 10:24
5d13791 to
cdf5d56
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #52. Registered ESP32 buttons are now visible in the PWA as a read-only section, backed by a new read endpoint.
Endpoint —
GET /api/home_intercom/devices(HA) andGET /devices+ the HA-style alias (Docker) return the registry snapshot keyed by MAC:{ "AA:BB:CC:DD:EE:FF": { "name": "Kitchen Button", "room": "living", "last_seen": "2026-07-24T08:00:00", "firmware_version": "1.0.0", "revoked": false } }PWA — an "Intercom Buttons" section under the room grid: name, bound room, firmware · last-seen per row; revoked buttons struck through. Hidden when the registry is empty or the endpoint is unavailable.
Design notes
RecordView) — unlike/rooms, this listing exposes device names and MACs, which are the registry's only auth material. The Docker route stays LAN-open, same trust model as/record.devices_payload()inshared.pyso both deployment targets stay identical.textContentonly (no innerHTML); re-renders on language switch through arenderDeviceshook ini18n.js.Verification
ruff check+ruff formatcleanTestDevicesView(token gate → 401, payload with valid token,{}without store) + Docker route tests (empty / registered / HA alias, isolated store)/devicesand the alias matches; HA extracts the PWA token from.storageand asserts 401-without-token + listing with token