home / skills / openclaw / skills / home-music

home-music skill

/skills/asteinberger/home-music

This skill lets you control whole-house music scenes by pairing Spotify with Airfoil, orchestrating playlists across speakers with a single command.

npx playbooks add skill openclaw/skills --skill home-music

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
7.6 KB
---
name: home-music
description: Control whole-house music scenes combining Spotify playback with Airfoil speaker routing. Quick presets for morning, party, chill modes.
homepage: local
metadata: {"clawdbot":{"emoji":"šŸ ","os":["darwin"]}}
triggers:
  - music scene
  - morning music
  - party mode
  - chill music
  - house music
  - stop music
---

```
    ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫
    
    šŸ   H O M E   M U S I C  šŸŽµ
    
    ╔══════════════════════════════════════════╗
    ā•‘   Whole-House Music Scenes               ā•‘
    ā•‘   One command. All speakers. Perfect.    ā•‘
    ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•
    
    ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫
```

> *"Why click 17 times when one command does the job?"* – Owen 🐸

---

## šŸŽÆ What Does This Skill Do?

**Home Music** combines Spotify + Airfoil into magical music scenes. One command – and the right playlist plays on the right speakers at the perfect volume.

**Imagine:**
- You wake up → `home-music morning` → Gentle tunes in the bathroom
- Friends arrive → `home-music party` → All speakers blasting rock
- Time to relax → `home-music chill` → Lounge vibes everywhere
- Done for the day → `home-music off` → Silence. Peace. Serenity.

---

## šŸ“‹ Dependencies

| What | Why | Link |
|------|-----|------|
| šŸ **macOS** | This skill uses AppleScript | — |
| 🟢 **Spotify Desktop App** | The music source! Must be running. | [spotify.com](https://spotify.com) |
| šŸ“” **Airfoil** | Routes audio to AirPlay speakers | [rogueamoeba.com](https://rogueamoeba.com/airfoil/) |
| šŸŽµ **spotify-applescript** | Clawdbot skill for Spotify control | `skills/spotify-applescript/` |

> āš ļø **Important:** Both Spotify and Airfoil must be running before you start any scenes!

---

## šŸŽ¬ Scenes

### šŸŒ… Morning
*A gentle start to your day*

```bash
home-music morning
```
- **Speaker:** Sonos Move
- **Volume:** 40%
- **Playlist:** Morning Playlist
- **Vibe:** ā˜• Coffee + good vibes

---

### šŸŽ‰ Party
*Time to celebrate!*

```bash
home-music party
```
- **Speaker:** ALL (Computer, MacBook, Sonos Move, Living Room TV)
- **Volume:** 70%
- **Playlist:** Rock Party Mix
- **Vibe:** 🤘 Neighbors hate this one trick

---

### 😌 Chill
*Pure relaxation*

```bash
home-music chill
```
- **Speaker:** Sonos Move
- **Volume:** 30%
- **Playlist:** Chill Lounge
- **Vibe:** 🧘 Om...

---

### šŸ”‡ Off
*Silence*

```bash
home-music off
```
- Pauses Spotify
- Disconnects all speakers
- **Vibe:** 🤫 Finally, peace and quiet

---

### šŸ“Š Status
*What's playing right now?*

```bash
home-music status
```

Shows:
- Current Spotify track
- Connected speakers

---

## šŸ”§ Installation

```bash
# Make the script executable
chmod +x ~/clawd/skills/home-music/home-music.sh

# Symlink for global access
sudo ln -sf ~/clawd/skills/home-music/home-music.sh /usr/local/bin/home-music
```

Now `home-music` works from anywhere in your terminal! šŸŽ‰

---

## šŸŽØ Custom Playlists & Scenes

### Changing Playlists

Open `home-music.sh` and find the playlist configuration:

```bash
# === PLAYLIST CONFIGURATION ===
PLAYLIST_MORNING="spotify:playlist:19n65kQ5NEKgkvSAla5IF6"
PLAYLIST_PARTY="spotify:playlist:37i9dQZF1DXaXB8fQg7xif"
PLAYLIST_CHILL="spotify:playlist:37i9dQZF1DWTwnEm1IYyoj"
```

**How to find Playlist URIs:**
1. Right-click on a playlist in Spotify
2. "Share" → "Copy Spotify URI"
3. Or copy the URL and extract the `/playlist/` part

### Adding a New Scene

Add a new case in the `main` block:

```bash
# In home-music.sh after the "scene_chill" function:

scene_workout() {
    echo "šŸ’Ŗ Starting Workout scene..."
    airfoil_set_source_spotify
    airfoil_connect "Sonos Move"
    sleep 0.5
    airfoil_volume "Sonos Move" 0.8
    "$SPOTIFY_CMD" play "spotify:playlist:YOUR_WORKOUT_PLAYLIST"
    "$SPOTIFY_CMD" volume 100
    echo "āœ… Workout: Sonos Move @ 80%, Pump it up!"
}

# And in the case block:
    workout)
        scene_workout
        ;;
```

### Available Speakers

```bash
ALL_SPEAKERS=("Computer" "Andy's M5 Macbook" "Sonos Move" "Living Room TV")
```

You can add any AirPlay speaker – they just need to be visible in Airfoil.

---

## šŸ› Troubleshooting

### āŒ "Speaker won't connect"

**Check 1:** Is Airfoil running?
```bash
pgrep -x Airfoil || echo "Airfoil is not running!"
```

**Check 2:** Is the speaker on the network?
- Open the Airfoil app
- Check if the speaker appears in the list
- Try connecting manually

**Check 3:** Is the name exactly correct?
- Speaker names are case-sensitive!
- Open Airfoil and copy the exact name

---

### āŒ "No sound"

**Check 1:** Is Spotify playing?
```bash
~/clawd/skills/spotify-applescript/spotify.sh status
```

**Check 2:** Is the Airfoil source correct?
- Open Airfoil
- Check if "Spotify" is selected as the audio source
- If not: Click "Source" → Select Spotify

**Check 3:** Speaker volume?
```bash
# Manually check volume
osascript -e 'tell application "Airfoil" to get volume of (first speaker whose name is "Sonos Move")'
```

---

### āŒ "Spotify won't start"

**Is Spotify open?**
```bash
pgrep -x Spotify || open -a Spotify
```

**Is spotify-applescript installed?**
```bash
ls ~/clawd/skills/spotify-applescript/spotify.sh
```

---

### āŒ "Permission denied"

```bash
chmod +x ~/clawd/skills/home-music/home-music.sh
```

---

## šŸ”Š Direct Airfoil Commands

If you want to control Airfoil manually:

```bash
# Connect a speaker
osascript -e 'tell application "Airfoil" to connect to (first speaker whose name is "Sonos Move")'

# Set speaker volume (0.0 - 1.0)
osascript -e 'tell application "Airfoil" to set (volume of (first speaker whose name is "Sonos Move")) to 0.5'

# Disconnect a speaker
osascript -e 'tell application "Airfoil" to disconnect from (first speaker whose name is "Sonos Move")'

# List connected speakers
osascript -e 'tell application "Airfoil" to get name of every speaker whose connected is true'

# Set audio source
osascript -e 'tell application "Airfoil"
    set theSource to (first application source whose name contains "Spotify")
    set current audio source to theSource
end tell'
```

---

## šŸ“ Files

```
skills/home-music/
ā”œā”€ā”€ SKILL.md        # This documentation
└── home-music.sh   # The main script
```

---

## šŸ’” Pro Tips

1. **Set aliases** for even faster access:
   ```bash
   alias mm="home-music morning"
   alias mp="home-music party"
   alias mc="home-music chill"
   alias mo="home-music off"
   ```

2. **Use with Clawdbot:**
   > "Hey, start party mode"
   > "Put on some chill music"
   > "Stop the music"

3. **Combine scenes:** Create a `dinner` scene with a jazz playlist at 25% – perfect for guests!

---

## 🐸 Credits

```
╭─────────────────────────────────────────────╮
│                                             │
│   Crafted with šŸ’š by Owen the Frog 🐸      │
│                                             │
│   "Ribbit. Music makes everything better."  │
│                                             │
╰─────────────────────────────────────────────╯
```

**Author:** Andy Steinberger (with help from his Clawdbot Owen the Frog 🐸)  
**Version:** 1.0.0  
**License:** MIT  
**Pond:** The one with the water lilies 🪷

---

*Did this skill improve your life? Owen appreciates flies. 🪰*

Overview

This skill provides quick whole-house music scenes by combining Spotify playback with Airfoil speaker routing. One command starts a preset scene (morning, party, chill, off) that selects playlist, target speakers, and volume. It runs on macOS and requires the Spotify desktop app and Airfoil to be running.

How this skill works

The script uses AppleScript to control Airfoil for connecting and setting volumes on AirPlay speakers, and delegates Spotify control to a small spotify-applescript helper. Each scene is a function that sets the Airfoil source, connects the desired speakers, adjusts volumes, and tells Spotify to play a configured playlist. A status command reports the current track and connected speakers.

When to use it

  • Wake-up routine with gentle music in one room
  • Start a party and broadcast to all speakers
  • Set a low-volume chill scene for relaxation
  • Quickly silence the house with an off command
  • Check current playback and speaker connections

Best practices

  • Ensure Airfoil and the Spotify desktop app are running before invoking scenes
  • Use exact, case-sensitive speaker names copied from Airfoil
  • Store playlist URIs in the script configuration for easy customization
  • Create shell aliases for one-word access to frequent scenes
  • Test speaker connections manually in Airfoil if a scene fails to connect

Example use cases

  • home-music morning — plays a morning playlist on the Sonos Move at ~40%
  • home-music party — routes Spotify to all speakers at ~70% for a house-wide party
  • home-music chill — low-volume lounge playlist on a single speaker for relaxation
  • home-music off — pauses Spotify and disconnects all AirPlay speakers
  • home-music status — shows current Spotify track and which speakers are connected

FAQ

What platforms and apps are required?

macOS is required. The Spotify desktop app and Airfoil must be running. The skill uses AppleScript to control Airfoil and relies on a spotify-applescript helper for Spotify control.

How do I change playlists or add a scene?

Edit the playlist URIs in the script configuration and add a new scene function with the speaker/volume commands, then add it to the main case block. Copy Spotify playlist URIs from the Spotify app via Share → Copy Spotify URI.