The Registry

I asked what felt like an easy question: how many devices are in this house? Home Assistant said 130. NetAlertX, which scans the network, said 104. Both were right, and that was the problem.

The Pi rack had grown one useful tool at a time, and each tool kept its own list of what I own. The lists didn't share IDs, didn't agree on names, and had different ideas about what “down” means. It was the Holy Roman Empire with Wi-Fi: seven little kingdoms, each sure it was the one in charge.

So I borrowed the rule from Highlander. There can be only one. The registry is a single file that lists every device, service, and job in the lab, and it says which system owns each fact about them. Everything else is a copy, and a script checks the copies every night.

Format: one YAML fileChanged by: pull requestSynced and checked: 3:45 AMRuns on: libertybowl

Last updated Dec 1, 2026

The problem

Seven systems, seven versions of the truth

Before I wrote any code, I mapped what each system knew and who was allowed to change it. Every row below is one fact that lived in more than one place.

FactWhere it livedHow the copies stayed in step
Device nameHome Assistant, NetAlertX, Uptime Kuma, and the AT&T gatewayThey didn't. Of the 64 devices in both Home Assistant and NetAlertX, about half had two different names.
RoomHome Assistant areas and NetAlertX locationsI copied them by hand, once. A room change in one never reached the other.
Server addressesThe gateway, the docs, the monitors, and 48 code and config filesBy hand. Moving one Pi meant finding every copy.
Which devices matterNetAlertX alert flags, Kuma's monitor list, and the daily page's rulesEach list was built on its own.
Is it down?Five definitions, from one missed ping to “gone 30 minutes, then 5 more”Each system decided for itself. A porch camera fell into the gap between two of them.
Who gets toldEmail, Pushover, an iPhone push, and the desk monitorOne outage could reach me twice, at two different times.
28 of 104

That's how many network devices shared an ID with Home Assistant. Another 34 were the same physical thing in both systems, matched only by my own guess at the name or model.

No single place to fix anything

Renaming a lamp meant renaming it in up to four places, and I never once remembered all four. The systems drifted a little further apart with every change.

Nothing was wrong, exactly

Every system worked. They just couldn't be trusted together, which is a harder thing to notice than something being broken.

The rule

One owner for every fact

A single source of truth can still be spread across several systems, as long as each fact has exactly one home and I know which one. Copies flow one way, from the owner out. If I edit a copy, the edit gets overwritten that night and shows up in a report.

FactOwnerWhy there
Online or offline, last seen, current addressNetAlertXIt measures them. A measured fact belongs to whatever measures it.
Sensor readings and device stateHome AssistantSame reason.
Name and room, for devices in Home AssistantHome AssistantThat's where I rename things anyway. The registry keeps a copy and the check refreshes it.
Name and room, for everything elseThe registryNothing else knows about them.
Type, group, owner, role, how critical it is, and its alert ruleThe registryThese are decisions, and decisions belong in a file with a history.
Reserved server addresses and what runs whereThe registryCode reads them from here. No address is typed into a script.
AutomationsHome AssistantI edit them in its UI. The repo keeps a copy of each, and the check flags a missing one.
Every room is a Home Assistant area

There's one list of rooms. If a row names a room Home Assistant doesn't have, the check flags it. Phones, watches, laptops, and tablets get a pass, since they wander.

Some things aren't stored at all

Current address, online status, battery level, vendor, and model stay out of the registry. Another system already measures them, and a second copy would only be a second thing to go stale.

Names follow one pattern

Room, then thing: Porch Switch. Or person, then thing, for personal devices. The Pis keep their stadium names.

The process

What happens at 3:45 every morning

Two scripts run back to back on libertybowl, the daily digest Pi. The sync pushes the owners' facts out. The check then reads everything back and writes down what still disagrees.

reserved addresses, on deploy everything else names, rooms, groups, alert flags then names, rooms, automations read back, to see what the sync changed A pull requestthe only way a row changes registry.yaml187 rows, one per thing Code and installersread hosts.env on each Pi Home Assistantowns names and rooms The syncsync.py, 3:45 AM NetAlertXthe only place it writes Uptime Kuma and the Pismonitors and SSH key lists The checkcheck.py, reads only Reportwhat disagrees Daily pageunder Needs attention
It writes to one place

The sync changes NetAlertX and nothing else. It reuses a token the daily page already had, so the job needed no new access.

It knows when to do nothing

The sync writes nothing if the registry fails its own schema, if Home Assistant or NetAlertX can't be read, or if more than 25 values would change at once. A change that big usually means something upstream broke.

One rule, used twice

The sync and the check both call the same function to decide what NetAlertX should say. They can't disagree with each other, which felt like the least I could ask of a tool built to end disagreements.

Quiet by design

Findings show up as one line on the daily page: “Registry check: 3 issues to review.” No push alert, and the spoken brief skips it. Drift is a chore, and chores can wait for daylight.

The schema

Three kinds of row

A device is something I can touch. A service is software that keeps running. A job runs on a schedule and stops. Services and jobs point at the device they run on, and a device points out to the systems that know it by another name.

a job's runs_on mac ha_devices kuma_monitor Every row id · kind · name · room · role · critical · down_class · watcher · notes One row per thing. The id never changes and is never reused, because other rows point at it. device156 rows. Something I can touch. macha_deviceskuma_monitortypegroup ownerreserved_iploginssubnet service11 rows. Software that stays up. runs_onurlcodekuma_monitor job20 rows. Runs, then stops. runs_onpart_ofschedule checkin_gracecodekuma_monitor NetAlertX115 rows link Home Assistant111 rows link Uptime Kumaany kind can link points at another row in the registry points at a record in another system
The ID is the whole trick

Each row gets an ID I choose, like downstairs-kitchen-speaker. The row then carries the other systems' IDs for the same thing. That one row is the link the systems never had.

One row per thing

My thermostats each show up twice in Home Assistant, once per integration. Each is still one row, with two Home Assistant IDs on it. The first one listed supplies the name and room.

Short rows

A field left out takes its default, so most rows are six or seven lines. A lamp nobody watches doesn't need to say so.

Fields on every row

FieldRequiredOwnerWhat it means
idYesRegistryLowercase words joined by hyphens, taken from the name when the row is created. Permanent. Pis use their hostname.
kindYesRegistrydevice, service, or job
nameYesHome Assistant if the device is in it, otherwise the registryThe display name
roomDevices, unless portableSame as nameMust match a Home Assistant area
roleNoRegistryOne line on what it's for: “Kitchen leak sensor”
criticalNoRegistryhigh if losing it risks safety or data, normal (the default), or low
down_classNoRegistryWhich definition of “down” applies. Default is not_watched.
watcherNoRegistryThe one system that raises the alarm: kuma, netalertx, home_assistant, or none
notesNoRegistryAnything a person should know, like “Battery doorbell, sleeps its Wi-Fi”

Device fields

FieldWhen it's setWhat it means
macIt's on the networkThe link to NetAlertX. Left out for things with no address of their own, like Hue bulbs behind their bridge.
ha_devicesIt's in Home AssistantA list of Home Assistant device IDs. The link to Home Assistant.
typeOptionalWhat it is: Smart Plug, Thermostat, Raspberry Pi. Copied to NetAlertX.
groupIt has a macOne of ten groups, such as Lights and switches or Cameras and doorbells. Copied to NetAlertX.
ownerOptionalA person's name. Defaults to House. Copied to NetAlertX.
reserved_ipServers and the gatewayThe fixed address. A script writes each one to a small file on every Pi, and code reads it from there.
loginsPis onlyWho can log in, and which SSH keys each login trusts. The check compares this with the Pi itself.
subnetThe gateway onlyThe home network's range. Exactly one row has it.
kuma_monitorKuma watches itThe monitor's exact name. Monitors are named exactly like the row they watch.

Service and job fields

FieldKindWhat it means
runs_onBoth, requiredThe id of the device it runs on
codeBothThe repo folder that holds its one current copy
kuma_monitorBoth, if Kuma watches itThe monitor's exact name
urlServiceThe address to open or check, if it has a web page
part_ofJobThe id of the service it belongs to, if any
scheduleJob, requiredWhen it runs, in plain words: daily 03:30
checkin_graceJob, if Kuma watches itHow long after the schedule before a missing check-in counts as missed

What a row looks like

DeviceNobody watches it
- id: downstairs-kitchen-speaker
  kind: device
  name: Downstairs Kitchen Speaker # from HA
  room: Downstairs Kitchen # from HA
  type: Smart Speaker
  group: Voice and displays
  mac: "aa:bb:cc:dd:ee:ff"
  ha_devices: [<HA device ID>]
ServiceKuma checks its page
- id: grafana
  kind: service
  name: Grafana
  runs_on: theforum
  url: http://<theforum>:3000
  down_class: service
  watcher: kuma
  kuma_monitor: Grafana
JobKuma waits for a check-in
- id: theforum-backup
  kind: job
  name: theforum backup
  runs_on: theforum
  schedule: daily 03:30
  checkin_grace: 2h
  critical: high
  down_class: service
  watcher: kuma
  kuma_monitor: theforum backup
Health

Four kinds of down, one watcher each

A server that misses a ping and a battery doorbell that naps between visitors shouldn't be judged the same way. Each row picks one class, and every screen and alert uses that same rule.

ClassDown meansRows
Always onMissed by a network scan, and still gone 5 minutes later17
SleepyNot seen for 30 minutes, and still gone 5 minutes after that7
ServiceKuma's check fails, or a job misses its check-in window15
Not watchedNever down. No alerts.148
Never two watchers

Each watched row names exactly one: Kuma has 16, NetAlertX has 22, and Home Assistant has 1. One outage, one alert. The check flags a row that has a class with no watcher, or a watcher with no class.

Who watches the watcher

Home Assistant's single row is heinzfield, the Pi that runs Kuma. Kuma can't very well report that its own Pi is off.

Most things aren't watched

148 of 187 rows raise no alarm, on purpose. If a lamp drops off Wi-Fi, I'll find out the old way, by flipping the switch and saying a word.

The check

What it catches

The check never fixes anything. It reads, compares, and reports, and I decide what to do about it over coffee.

1
A broken row

A required field missing, a field it doesn't know, a value off the allowed list, a duplicate ID, or a runs_on that points nowhere.

2
A stranger on the network

A device NetAlertX found that has no row yet. Or the reverse: a row whose address the network has never seen.

3
Drift from Home Assistant

A copied name or room that no longer matches, a Home Assistant ID that's gone, or a Home Assistant device with no row.

4
An edit in the wrong place

Any NetAlertX value the sync had to overwrite that night. That's me, having changed a copy and forgotten the rule.

5
A monitor with no row

A Kuma monitor the registry doesn't list, or a row that names a monitor Kuma doesn't have.

6
A key that shouldn't be there

An SSH key on a Pi that isn't in that Pi's row, or a listed key that's missing.

7
An automation with no copy

A Home Assistant automation the repo has no copy of, or a copy whose automation was deleted.

8
A sync that didn't run

If the sync skipped the night or refused to write, the report says so and says why.

What changed

What one list bought me

Rename once

I rename a device in Home Assistant, and by morning the network scanner and the registry copy agree with it. Nobody copies anything by hand.

Addresses in one place

A Pi's address lives on its row. Deploys, installers, and scripts read it from there, so moving a server is one line in one pull request.

A history

The registry is a file in git, so every change has a date and a reason. “When did we stop watching that?” has an answer now.

A place to ask the question

How many devices are in this house? 156, and I can show my work.