Relay: log upstream events + forward error envelopes to device for diagnostics
Plan 3 smoke surfaced 'session_ended reason=error' on every wake with no context. The relay now logs every upstream event type at INFO and forwards any upstream 'error' event to the device as 'error code=upstream_<code>' so it appears in the Pi's journal alongside the wake/session_ended pair. Also extends the client's wakeword.predict with per-frame RMS + score diagnostics and the bridge loop with a 5 s heartbeat for triage.
This commit is contained in:
+6
-1
@@ -39,9 +39,14 @@ class WakewordDetector:
|
||||
def predict(self, frame_16k_int16: np.ndarray) -> bool:
|
||||
scores = self._model.predict(frame_16k_int16)
|
||||
score = float(scores.get(WAKEWORD, 0.0))
|
||||
rms = float(np.sqrt(np.mean(frame_16k_int16.astype(np.float32) ** 2)))
|
||||
now = time.monotonic()
|
||||
# Diagnostic: log any non-trivial score so we can see what's getting
|
||||
# close to firing.
|
||||
if score >= 0.1:
|
||||
_log.info("score=%.3f rms=%.0f", score, rms)
|
||||
if score >= self._threshold and (now - self._last_fired) >= self._cooldown_s:
|
||||
self._last_fired = now
|
||||
_log.info("wakeword fired score=%.3f", score)
|
||||
_log.info("wakeword fired score=%.3f rms=%.0f", score, rms)
|
||||
return True
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user