Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/architecture.md

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,51 @@ docstring gives: it is a record, not a claim about now.

## 2026-11-18

- **The wall page reads the house and the family calendar from Home
Assistant.** Its header now shows the weather; a Today panel under the
alerts lists today's and tomorrow's events; and its bottom row reads the
Ring Alarm's mode, the four door contacts, the two window contacts and the
office lights.
- **How it reads them:** ten fixed `/api/ha/NAME` handles in the
Caddyfile, each one `GET /api/states/<entity>`, with the token of HA's
new non-admin `wall` user (`WALL_HA_TOKEN`, added by #1563).
- **The calendar** is Google Calendar, added to HA through its own
integration. A new package, `wall_calendar.yaml`, gathers today's and
tomorrow's events into `sensor.wall_today` every five minutes. It reads
the calendars labelled `wall_calendar`, or all of them when none is, so no
calendar is named in the repository. Booted on Home Assistant 2026.11.1
with its demo calendars: the sensor held both events, and with no
calendar it read unavailable.
- **Read-only by narrowing.** HA has no read-only role, so the narrowing
in Caddy is the read-only part. `security.md` names the residual, which
now includes the two-day schedule.
- **No renames.** The alarm's and the office lights' own ids name the city
and a person, so a second package, `wall_house.yaml`, finds them (the
one alarm panel; any light whose id contains `office`) and the Caddyfile
names only its two template entities.

- **`heimdall` drives the office television at 1080p, and the television
stays on.** This completes the 2026-11-17 `heimdall` entry, which said
the HDMI output, the kiosk and CEC were not yet verified.
- **First light:** HDMI-A-1 `connected`, the wall page full-screen, the
Pi at 49.9 °C with `throttled=0x0`.
- **The mode came up at 1280 × 720.** The Changhong's EDID is a generic
one ("DMTF", `CHHWJT*`, serial 1) that prefers 720p and also lists
1080p. The `video=` boot line sets only the console; labwc takes its
mode from `kanshi`, whose config was empty. A one-output profile now
sets 1920 × 1080 at 60 Hz. It is sharp, nothing is cut off, and it
survived a reboot (`build-heimdall.md` §5).
- **The set has no HDMI-CEC.** Its manual never mentions it, and the
Pi's probe allocated no logical address and found no topology. So
neither path in ADR-0119 decision 5 works on this television:
- CEC cannot reach it.
- Turning the Pi's output off would leave it in standby, because the
set switches itself off without a signal and nothing could wake it.

It stays on day and night, which needs its Auto Sleep and Sleep timers Off.
A smart plug or an infrared LED would be a purchase and an ADR of its
own (`build-heimdall.md` §8).

- **`eden` no longer asks for an address while it boots, and template `901`
stops making guests that do.** `eden` was off when "Every 26.04 lab guest
asked the lab's DHCP server for an address while it booted", below, was
Expand Down
2 changes: 1 addition & 1 deletion docs/hardware.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ The office's dashboard, outside the rack

| Part | What | Notes |
| --- | --- | --- |
| Screen | Changhong 40" 1080p LED television (2014) | On a SANUS single-stud tilt mount on the office's front wall, above the desk's monitors, since 2026-10-31. About seven feet from the chair |
| Screen | Changhong 40" 1080p LED television (2014) | On a SANUS single-stud tilt mount on the office's front wall, above the desk's monitors, since 2026-10-31. About seven feet from the chair. Driven at 1920 × 1080 by a `kanshi` profile, because its generic EDID prefers 1280 × 720. **No HDMI-CEC**, so it stays on, and its Auto Sleep and Sleep timers must be Off (`build-heimdall.md` §5, §8) |
| `heimdall` | Raspberry Pi 5, 2 GB, 64 GB microSD | Behind the screen, on Hicks over Wi-Fi. Raspberry Pi OS 13 with its own desktop, Chromium in kiosk mode. Arrived 2026-11-16 |
| Power | Official 27 W USB-C supply for the Pi; the screen's own cord | Neither is on the UPS. Which outlet they reach is not yet settled: the office's right wall and alcove have none |

Expand Down
77 changes: 55 additions & 22 deletions docs/runbooks/build-heimdall.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,32 @@ not boot, put the card in `oracle` and restore the `.bak`. After the reboot:
cat /sys/class/drm/card1-HDMI-A-1/status # connected
```

**The desktop's mode comes from `kanshi`, not from that line.** `video=`
sets the boot console and forces the output on. labwc takes whatever mode
the television's EDID calls *preferred*. This Changhong's EDID is a generic
one ("DMTF", model `CHHWJT*`, serial 1, and a 710 × 400 mm size that is not
a 40" panel's), and it prefers **1280 × 720**, while 1920 × 1080 at 60 Hz is
also in its list. Raspberry Pi OS runs `kanshi` to set modes, and an empty
`~/.config/kanshi/config` leaves the preferred one. Give it a profile:

```bash
cp ~/.config/kanshi/config ~/.config/kanshi/config.bak
cat > ~/.config/kanshi/config <<'KANSHI'
profile wall {
output HDMI-A-1 mode 1920x1080@60.000 position 0,0
}
KANSHI
sudo reboot
# after the reboot:
WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/1000 wlr-randr | grep current
# 1920x1080 px, 60.000000 Hz (current)
```

Measured on 2026-11-18: sharp at 1080p, no edge cut off (the set's aspect
setting is *Full*, under Picture), and the mode survived a reboot. The page
scales its 1920 × 1080 stage to whatever mode it gets, so a wrong mode only
softens the text. It never crops the page.

## 6. Trust the tier's root, in Chromium's store

Chromium on Linux reads its own NSS database, not the system's store, so
Expand Down Expand Up @@ -158,34 +184,39 @@ URL above. It is the page the kiosk has shown since 2026-11-17
put the Glance URL back by hand: nothing fails over on its own. Switching
either way is this line's URL and a reboot, nothing else. `--password-store=basic` stops Chromium
asking for a keyring at boot, which would otherwise sit on the screen.
Blanking off keeps the desktop from turning the screen off. §8 turns the
television off instead.
Blanking off keeps the desktop from turning the screen off. The screen stays
on day and night (§8).

**Verify at the wall:** after a reboot, the page fills the screen with no
address bar, no padlock warning and no keyring prompt.

## 8. The television, on and off

Ask whether the television takes orders over HDMI-CEC:

```bash
cec-ctl -d /dev/cec0 --playback -S # the TV appears as device 0
cec-ctl -d /dev/cec0 --to 0 --standby # it goes off
cec-ctl -d /dev/cec0 --to 0 --image-view-on # it comes back
```

If it obeys, schedule those two commands for the hours the office is empty.
If it does not, switch the Pi's output off instead. The television then shows
"no signal" and, on most sets, sleeps:

```bash
wlr-randr --output HDMI-A-1 --off
wlr-randr --output HDMI-A-1 --on
```

`wlr-randr` talks to the running compositor, so run it as the desktop's user
with `WAYLAND_DISPLAY` set (`wayland-0` under labwc). Record which one worked
in the changelog.
**This set has no HDMI-CEC.** Its manual (FCC ID 2ABNO40YD1100UA) never
mentions it, and on 2026-11-18 the Pi's probe found nothing. `cec-ctl -d
/dev/cec0 --playback -S` gave the Pi's own adapter the physical address
`1.0.0.0`, taken from the television's EDID: it says which HDMI input the Pi
is on, not that the set answered. The television, which would be `0.0.0.0`,
never replied. No logical address was allocated, and the topology was empty.
So nothing on the Pi can turn the set off or wake it.

What the manual does say, and what follows from it:

- **Without a signal it switches itself off,** after 5 minutes ("TV mode")
or 60 seconds ("PC mode"). So switching the Pi's output off at night
(`wlr-randr --output HDMI-A-1 --off`) would put it in standby with nothing
to wake it in the morning but the remote.
- **Time menu → Auto Sleep must be Off,** and so must Sleep. Auto Sleep puts
the set in standby after a set time with "no operation", meaning no
remote press, so it would blank the wall part-way through every day while
the picture is fine.

**The screen therefore stays on, day and night.** The page is dark and still
when nothing is wrong, and an LED panel does not burn in. Turning it off on a
schedule would take a smart plug (only if the set comes back on by itself
when power returns, which is untested) or an infrared LED on the Pi
replaying the remote's power code. Either is a purchase, so it goes through
the roadmap's *Everything still to buy* and an ADR of its own.

## 9. Undo

Expand All @@ -198,3 +229,5 @@ in the changelog.
- **The kiosk:** remove the line from `~/.config/labwc/autostart`.
- **The root:** `certutil -d sql:$HOME/.pki/nssdb -D -n "matrix.elysium tier CA"`.
- **The boot line:** restore `/boot/firmware/cmdline.txt.bak`.
- **The mode:** restore `~/.config/kanshi/config.bak`. The desktop falls back
to the television's preferred 1280 × 720.
15 changes: 15 additions & 0 deletions docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,21 @@ from Home Assistant with *not enough permissions*.
firing alerts, per-host CPU, SNMP reachability, WAN traffic and latency,
the UPS and `heimdall`'s temperature. That is less than the Homelab page
already shows, and the page and the Pi hold no credential.
**Its household half reads ten Home Assistant entities the same way.**
Each `/api/ha/NAME` is one `GET /api/states/<entity>` written in the
Caddyfile: the weather, the alarm's mode, four door contacts, two window
contacts, the office lights, and `sensor.wall_today`, which holds today's
and tomorrow's calendar events. Caddy adds the token of HA's non-admin
`wall` user. Home Assistant has no read-only role, so that token could call
services, the alarm's included. It is read-only only because it lives in
Caddy's environment alone and Caddy forwards nothing but those GETs. The
residual is that whoever can read that container's environment holds a
token that can operate the house. They would already be root on the host
that runs Home Assistant. Anything that reaches `trinity:443` can read
whether the doors are open, whether the alarm is set, and the family's
schedule for two days: each event's title, time and location. That is the
same as the Home Assistant app shows to the household, without its login.
The calendars' names, descriptions and attendees are not passed on.
- `snmp-exporter` is never published to a host interface — it is reachable only
on the compose network.
- Alertmanager binds to `127.0.0.1` only. It is unauthenticated, and a silence
Expand Down
1 change: 1 addition & 0 deletions scripts/seed-validation-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ STACK="${REPO_ROOT}/stacks/${2:-observability}"
echo "INGEST_TOKEN=validation-only-client"
echo "GLANCE_PROMETHEUS_TOKEN=validation-only"
echo "HA_PROMETHEUS_AUTHORIZATION=Bearer validation-only"
echo "WALL_HA_TOKEN=validation-only"
echo "HA_MEDIATV_MAC=00:00:5e:00:53:00"
echo "MQTT_HA_PASSWORD=validation-only-ha"
echo "MQTT_RING_PASSWORD=validation-only-ring"
Expand Down
15 changes: 15 additions & 0 deletions secrets/sensitive.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,21 @@ GLANCE_PAPERLESS_TOKEN: change-me-to-the-homepage-users-token
GLANCE_PROMETHEUS_TOKEN: change-me-to-the-reader-token
HA_PROMETHEUS_AUTHORIZATION: Bearer change-me-to-the-reader-token

# The office wall page's Home Assistant token (ADR-0119): the long-lived token
# of the non-admin HA user `wall`, minted in a private window while logged in
# as that user (Profile -> Security -> Long-lived access tokens, named
# `wall-caddy`), with "Can only log in from the local network" on.
#
# HOME ASSISTANT HAS NO READ-ONLY ROLE. This token can call services, unlock
# included. What keeps it read-only is where it lives: only in the caddy
# service's environment, which forwards GET alone to the fixed
# /api/states/<entity> paths the Caddyfile's wall.matrix.elysium block lists.
# It is never on heimdall and never in the page. docs/security.md says so.
#
# Rotating it: delete the old token in HA as `wall`, mint a new one, replace
# it here, then `make up STACK=sensitive`.
WALL_HA_TOKEN: change-me-to-the-wall-users-long-lived-token

# The LG TV's full wired MAC, for Home Assistant's Wake-on-LAN call
# (ADR-0097, #1218). It is not a credential. It is here because
# docs/security.md truncates every MAC in the repository to its OUI, and SOPS
Expand Down
75 changes: 75 additions & 0 deletions stacks/sensitive/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ start.matrix.elysium {
# can query and nothing more (ADR-0067); this narrows it again,
# to eight answers. The page holds no credential, and neither
# does the Pi.
# /api/ha/NAME one Home Assistant entity's state, the same way: each handle
# rewrites to /api/states/<one entity> and ends in `?`, which
# drops the client's query string, and the `wall` user's token
# is added here (the wall_ha snippet).
#
# The token is the one Glance already holds, GLANCE_PROMETHEUS_TOKEN, given
# to the caddy service in compose.yaml. It is the estate's READER, which
Expand All @@ -302,6 +306,18 @@ start.matrix.elysium {
}
}

# The household half of the wall page: Home Assistant, on this network, with
# the token of its non-admin `wall` user added here. HA has no read-only
# role, so the narrowing below is what makes this read-only: one GET of one
# entity's state per handle, and nothing else under /api/ha/.
(wall_ha) {
reverse_proxy home-assistant:8123 {
header_up Authorization "Bearer {$WALL_HA_TOKEN}"
header_up -Cookie
header_down -Set-Cookie
}
}

wall.matrix.elysium {
header {
Content-Security-Policy "default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self'; font-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
Expand Down Expand Up @@ -374,6 +390,65 @@ wall.matrix.elysium {
import wall_prometheus
}

# The header's weather: condition, temperature, humidity, wind.
handle /api/ha/weather {
rewrite * /api/states/weather.forecast_home?
import wall_ha
}

# The Ring Alarm's mode, through a template entity in
# home-assistant/packages/wall_house.yaml: the alarm's own id names the city.
handle /api/ha/alarm {
rewrite * /api/states/sensor.wall_alarm?
import wall_ha
}

# Ring contact sensors: on is open.
handle /api/ha/front_door {
rewrite * /api/states/binary_sensor.front_door?
import wall_ha
}

handle /api/ha/garage_door {
rewrite * /api/states/binary_sensor.garage_door?
import wall_ha
}

handle /api/ha/garden_door {
rewrite * /api/states/binary_sensor.garden_door?
import wall_ha
}

handle /api/ha/patio_door {
rewrite * /api/states/binary_sensor.patio_door?
import wall_ha
}

handle /api/ha/window_left {
rewrite * /api/states/binary_sensor.window_left?
import wall_ha
}

handle /api/ha/window_right {
rewrite * /api/states/binary_sensor.window_right?
import wall_ha
}

# The office lights, on when any is on, through a template entity in
# home-assistant/packages/wall_house.yaml: their own ids name a person.
handle /api/ha/office_light {
rewrite * /api/states/binary_sensor.wall_office_lights?
import wall_ha
}

# Today's and tomorrow's events, gathered from the calendars by
# home-assistant/packages/wall_calendar.yaml. A calendar's own API needs
# a moving start and end, which a fixed handle cannot give.
handle /api/ha/today {
rewrite * /api/states/sensor.wall_today?
import wall_ha
}

handle /api/* {
respond "no such question" 404
}
Expand Down
31 changes: 28 additions & 3 deletions stacks/sensitive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,34 @@ container of its own: Caddy serves `wall/` as static files.
Watchdog that is not firing, is shown in red as exactly that, never as
"All quiet". A host that stops reporting reads *no data*. The status bar
gives each source's age and turns amber at two and a half minutes.
- **The household half is not here yet.** The calendar, the weather and the
house come through Home Assistant in a later change, the same way: fixed
entities, a token added by Caddy.
- **The household half comes from Home Assistant, the same way.** Each
`/api/ha/NAME` rewrites to `GET /api/states/<one entity>`. The rewrite ends
in `?`, so the client's query string is dropped. Caddy adds
`WALL_HA_TOKEN`, the token of HA's non-admin `wall` user. The entities are
`weather.forecast_home`, the front, garage, garden and patio door contacts,
the two window contacts, and two template entities from
`home-assistant/packages/wall_house.yaml`: `sensor.wall_alarm` (the
house's one alarm panel) and `binary_sensor.wall_office_lights` (on when
any light whose id contains `office` is on).
The page shows them as the header's weather and a one-line Home row: the
alarm's mode, any open door or window in amber, and the office lights.
The calendar is `sensor.wall_today` at `/api/ha/today`: the package
`home-assistant/packages/wall_calendar.yaml` asks `calendar.get_events`
every five minutes for today and tomorrow, from the calendars labelled
`wall_calendar` in HA's UI, or from every calendar when none is labelled.
It keeps each event's title, start, end, location and a calendar number for
its colour, and shows them in the Today panel under the alerts. Booted on
Home Assistant 2026.11.1 against its demo calendars on 2026-11-18: the
sensor held both events, and with no calendar it read unavailable, which
the page shows as `calendar · unavailable`. The real ids of the alarm and the
office lights name the city and a person, so the package finds them and
only its own ids are written here. Booted on Home Assistant 2026.11.1 with
a stand-in alarm and office light, both followed the real ones from
disarmed and off to armed and on. HA has no read-only role, so the narrowing in
Caddy is the read-only part (`docs/security.md`). Measured against the
pinned Caddy with a stand-in HA on 2026-11-18: each handle reached only
its entity with the token, `?x=1` was dropped, POST was refused with 405,
and `/api/states/…` directly was 404.
- **Adding it to the running tier.** On `trinity`:
1. Add `wall` to `trinity`'s *Additional Names for this Host* on `morpheus`
([`add-a-host-override.md`](../../docs/runbooks/add-a-host-override.md)),
Expand Down
4 changes: 4 additions & 0 deletions stacks/sensitive/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ services:
# secrets/sensitive.example.yaml lists.
environment:
GLANCE_PROMETHEUS_TOKEN: ${GLANCE_PROMETHEUS_TOKEN:?set in secrets/sensitive.sops.yaml}
# And Home Assistant's `wall` user, for the page's fixed household
# entities, added to GET /api/states/<entity> only. HA has no read-only
# role, so this narrowing is the read-only part.
WALL_HA_TOKEN: ${WALL_HA_TOKEN:?set in secrets/sensitive.sops.yaml}
mem_limit: 128m
memswap_limit: 128m
cap_drop: [ALL]
Expand Down
Loading
Loading