Skip to content

#115 Tile 5: sound-balance sparkline from dotty-behaviour#120

Merged
BrettKinny merged 2 commits into
mainfrom
dashboard-rewire-sound-balance
May 23, 2026
Merged

#115 Tile 5: sound-balance sparkline from dotty-behaviour#120
BrettKinny merged 2 commits into
mainfrom
dashboard-rewire-sound-balance

Conversation

@BrettKinny
Copy link
Copy Markdown
Owner

Summary

Tile 5 of #115 — rewire the dashboard State-tile sound-balance sparkline to read live data from dotty-behaviour.

  • Endpoint — adds GET /api/perception/sound-balance/{device_id}?limit=30 to dotty-behaviour. Projects data.balance out of the per-device recent-events ring, filtering to sound_event only, oldest-first to match the sparkline's left-to-right time axis. Non-numeric/missing balances skipped.
  • Getter shape_dashboard_sound_balance_series() in bridge.py now returns a list[float] from the new endpoint (same signature as before, just no longer stubbed empty). Goes through the existing _dotty_behaviour_get helper so it shares the 1.5s timeout, 2s cache, and circuit-breaker fallback.
  • Device picking — first key from _dashboard_perception_state_getter() (single-robot heuristic). Matches what the other dotty-behaviour-backed getters do; mirroring the fancier _pick_perception_device_id in dashboard.py wasn't worth the cross-module dependency for a single-robot deployment. Returns [] cleanly when no device is known.

Refs #115 (Tile 6 still pending).

Test plan

  • cd dotty-behaviour && ../.venv/bin/python -m pytest tests/ -q211 passed (was 209)
  • .venv/bin/python -m pytest tests/ -q76 passed (was 73)
  • python -c "import bridge; from bridge.dashboard import *" clean
  • Live verify against the deployed bridge once dotty-behaviour is rolled — sparkline should populate after a handful of sound_event frames.

🤖 Generated with Claude Code

BrettKinny and others added 2 commits May 24, 2026 00:42
Projects sound_event balance values out of the per-device recent ring
(oldest-first, non-numeric balances skipped). Backs the bridge
dashboard's State-tile sparkline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the empty-list stub with a live read against
/api/perception/sound-balance/{device_id}. Device picked from the
first key in the perception state snapshot (single-robot heuristic,
matches the other dashboard perception getters). Returns [] when no
device is known or the fetch fails — same circuit-breaker contract
as the other dotty-behaviour-backed getters.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 23, 2026 14:43
@BrettKinny BrettKinny merged commit 6925845 into main May 23, 2026
8 of 10 checks passed
@BrettKinny BrettKinny deleted the dashboard-rewire-sound-balance branch May 23, 2026 14:44
@BrettKinny BrettKinny review requested due to automatic review settings May 23, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant