From 2d5b506ed9550c0c81ae2d7cbd8ecf65f523d7d5 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 3 Feb 2026 23:52:15 -0600 Subject: [PATCH] update status --- vixy_status.py | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/vixy_status.py b/vixy_status.py index f0b8b9d..3c090dd 100644 --- a/vixy_status.py +++ b/vixy_status.py @@ -17,6 +17,7 @@ from datetime import datetime, timedelta # Service endpoints ENVIRO_URL = "http://eye1.local:8767" OAK_URL = "http://head-vixy.local:8100" +HEADMIC_URL = "http://head-vixy.local:8446" # State files STATE_FILE = Path.home() / ".claude-automation-state.json" @@ -143,6 +144,34 @@ def get_presence_status() -> str: return None # Return None to omit line if camera unavailable +def get_sound_status() -> str: + """Get ambient sound classification from headmic service.""" + try: + response = requests.get(f"{HEADMIC_URL}/sounds", timeout=5) + if response.status_code == 200: + data = response.json() + category = data.get('dominant_category') + top_classes = data.get('top_classes', []) + + if not category or category == 'silence': + return None # Omit line if silent or no data + + # Get top class score as percentage + top_score = int(top_classes[0]['score'] * 100) if top_classes else 0 + + # Get top 2-4 class names + class_names = [c['name'] for c in top_classes[:4] if c['score'] > 0.1] + classes_str = '/'.join(class_names) if class_names else '' + + if classes_str: + return f"{category} ({top_score}% {classes_str})" + else: + return f"{category}" + except Exception: + pass + return None # Return None to omit line if service unavailable + + def get_matrix_status() -> str: """Get Matrix message status from state file""" try: @@ -208,10 +237,11 @@ def get_vision_status() -> str: def format_status_for_wakeup() -> str: """ Format full status string for daemon wakeup message. - + Returns format like: [ENV] Basement: 69.8F, 24.5% humidity, 24.6 lux [WHO] Foxy: present (87%, moving) + [EAR] music (67% Ambient music/Electronic music) [CAM] Vision: 12 motion events (basement: 12) """ lines = [] @@ -224,7 +254,12 @@ def format_status_for_wakeup() -> str: presence_status = get_presence_status() if presence_status: lines.append(f"[WHO] {presence_status}") - + + # Sound (only if available and not silent) + sound_status = get_sound_status() + if sound_status: + lines.append(f"[EAR] {sound_status}") + # Vision vision_status = get_vision_status() lines.append(f"[CAM] {vision_status}")