lume-visual-dashboard

Canopy (Hare live PVs)

Live PV data comes from the Hare module of Canopy. Set VITE_CANOPY_API_BASE_URL (default http://localhost:8050) and VITE_CANOPY_API_KEY (default dev, sent as X-API-Key). The key ends up in the browser, so only use a read-only key. In the cluster it comes from a Secret instead. The Canopy code in src/api/canopy/ follows the same three-layer pattern as the lume-model-api code: getPv/describePv, hareKeys/hareQueries, and the hooks in src/hooks/useHare.ts. Errors are thrown as the same LumeApiError.

const { data: meta } = usePvMeta('TEST:SINE'); // units, precision, limits, enum labels
const { data: pv } = usePv('TEST:SINE', { refetchInterval: 1000 }); // value, severity, tsNs

Hare stream (WebSocket)

For values that update continuously, use the stream instead of polling usePv. Hare sends each PV’s value and metadata once it connects, then batches changes every 100 ms.

const { status, value, meta, rejected, backend } = usePvStream('TEST:SINE');
const { pvs } = useHareStream(['TEST:SINE', 'TEST:WF']); // pvs['TEST:WF'].value?.value

status takes the same values as useLiveStream’s (idle, connecting, open, reconnecting, closed), and both return reconnect().