Bump to v2.0.0: daily emote rotation + expanded sound library

- Emote face is now stable all day; /wake picks a fresh random face each
  morning instead of rotating every 5 minutes. Removes EMOTE_ROTATION_INTERVAL
  and last_emote_change entirely.
- Added 10 new synthesized sounds for /notify: doorbell, knock, ding, blip,
  siren, tada, ping, bubble, fanfare, and alarm (loops until tapped or TTL
  expires). stopAlarm() wired into tap handler and handleStateChange().
- openapi.yaml: new sound names added to enum.
- CLAUDE.md / README.md updated to reflect both changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 16:36:23 -06:00
parent dd8bf6005b
commit a074a42d40
7 changed files with 190 additions and 113 deletions

View File

@@ -19,14 +19,12 @@ ROOT_DIR = Path(__file__).parent
STATUS_FILE = Path(__file__).parent / "status.json"
DEFAULT_NOTIFY_TTL = 10 # Default TTL for Priority 3 (Notify) events
CELEBRATION_DURATION = 5 # Seconds to show celebration after recovery
EMOTE_ROTATION_INTERVAL = 300 # Seconds between emote rotations
IDLE_EXPRESSION_CHANCE = 0.15 # Chance of a brief blink/wink on rotation
IDLE_EXPRESSION_CHANCE = 0.15 # Chance of a brief blink/wink on wake
DEFAULT_NOTIFY_DURATION = 5 # Default duration for /notify events
# Emote variations with paired animations
OPTIMAL_EMOTES = [
("( ^_^)", "breathing"), # calm, content
("( ˙▿˙)", "floating"), # content
("(◕‿◕)", "bouncing"), # cheerful
("( ・ω・)", "swaying"), # curious
("( ˘▽˘)", "breathing"), # cozy
@@ -56,7 +54,6 @@ celebrating_until = 0
blinking_until = 0
blink_emote = None
blink_animation = None
last_emote_change = time.time()
current_optimal_emote = OPTIMAL_EMOTES[0][0]
current_optimal_animation = OPTIMAL_EMOTES[0][1]
@@ -73,7 +70,7 @@ SLEEP_ANIMATION = "sleeping"
def get_current_state():
"""Determine current state based on active events."""
global previous_priority, celebrating_until, blinking_until, blink_emote, blink_animation
global last_emote_change, current_optimal_emote, current_optimal_animation
global current_optimal_emote, current_optimal_animation
# Sleep mode overrides everything
if is_sleeping:
@@ -139,14 +136,6 @@ def get_current_state():
emote = blink_emote
animation = blink_animation
else:
# Rotate optimal emotes every 5 minutes
if now - last_emote_change > EMOTE_ROTATION_INTERVAL:
last_emote_change = now
current_optimal_emote, current_optimal_animation = random.choice(OPTIMAL_EMOTES)
# Brief blink/wink chance on rotation
if random.random() < IDLE_EXPRESSION_CHANCE:
blink_emote, blink_animation = random.choice(IDLE_EMOTES)
blinking_until = now + random.uniform(1, 2)
emote = current_optimal_emote
animation = current_optimal_animation
@@ -326,8 +315,13 @@ def sleep_mode():
@app.route("/wake", methods=["POST"])
def wake_mode():
"""Exit sleep mode. For Home Assistant webhook."""
global is_sleeping
global is_sleeping, current_optimal_emote, current_optimal_animation
global blink_emote, blink_animation, blinking_until
is_sleeping = False
current_optimal_emote, current_optimal_animation = random.choice(OPTIMAL_EMOTES)
if random.random() < IDLE_EXPRESSION_CHANCE:
blink_emote, blink_animation = random.choice(IDLE_EMOTES)
blinking_until = time.time() + random.uniform(1, 2)
state = write_status()
return jsonify({"status": "awake", "current_state": state}), 200