Returns the device's settings document: the stored JSONB, plus the settings
that live in real columns, plus config_version last - mirroring
configApplyJson, which applies the version only after the rest of the payload
has been processed.
No response model, deliberately. devices.config is one JSONB document rather
than forty columns because the firmware grows tunables faster than a schema
should change, and the device merges and clamps whatever arrives: unknown
keys ignored, absent keys left alone, dangerous values clamped on the device
itself. Partial documents are the normal case, not a degraded one. Validating
this shape belongs on the write path, when the admin UI saves a config.
Unknown keys are passed through rather than filtered, so the admin UI can
push a new firmware tunable without waiting for the server to learn it.
Column-backed keys win over any stale copy of themselves in the JSONB. The
columns are the modelled source of truth, and a leftover key shadowing one
would mean a change to the column never reached the camera.
This also closes a loop left open at enrollment. Enrollment refuses to let a
device overwrite a rename made in the admin UI, which raised the fair
question of how the rename ever reaches the device. It reaches it here:
configApplyJson merges device_name like any other key (app_config.cpp:307).
The operator owns the name, the server pushes it down, and the device adopts
it - so the two decisions are consistent rather than merely defensible.
Named device_config.py so it does not read as poorbird.config. The route is
/config as specified.
Tests: 99 -> 109. Verified by letting the JSONB win over the columns: the
precedence test fails, as intended.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>