update status

This commit is contained in:
Alex
2026-02-03 23:52:15 -06:00
parent b476309f8e
commit 2d5b506ed9

View File

@@ -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}")