This turns any Linux computer, like a Raspberry Pi, into a Muse gadget. Install it, pair it with the Muse app, and Muse can run commands and move files on the machine.
Then make it your own: wire up a sensor, bridge a webhook, or give Muse a new command.
Note: Built by hackers, for hackers, just for fun. Proceed at your own risk! Muse gets the same access to the machine as the account you install it for.
- A Raspberry Pi with Bluetooth: a 3B+, 4, 5 or Zero 2 W. Other Linux computers work too, as long as they have Bluetooth LE.
- Raspberry Pi OS Bullseye or later, Debian 11 or later, or Ubuntu 22.04 or later, already on your network. 32-bit and 64-bit both work.
- An account with sudo on the machine.
- An SDK token from gadgets.muse.ai (Account > SDK tokens). Every gadget needs one to pair, including ones you build for yourself. Read the Gadget SDK Terms before you use it.
- The Muse app on your phone, to pair the device.
On the machine, as the account Muse should use:
curl -fsSL https://raw.githubusercontent.com/facebookincubator/muse-gadget-sdk/main/linux/install.sh -o install.sh
less install.sh # read it first
bash install.sh --sdk-token mgst_…The installer checks your system, installs what it needs into
/opt/musegadget, and starts the musegadget service. Before it gives Muse
your account, it asks, and tells you if that account can use sudo. Then it
opens Bluetooth pairing.
When the installer says pairing is open, go to the Muse app:
- Turn on Settings > Devices > Developer mode.
- Add a device (Settings > Devices > Add Device, the + icon in the
top right). It shows up as
MuseGadgetXXXXXX, with the name the installer printed. - Muse warns that this is a community device. Continue if it's yours.
- When asked for Wi-Fi, pick the network shown. The machine is already online, so no password is needed.
That's it: the device connects to Muse and stays connected, across reboots.
Pairing is open for 10 minutes. To pair again later, run
sudo musegadget pair.
Every setup creates a fresh encrypted session, and pairing only opens when you
run the installer or musegadget pair on the machine itself. Because these are
community devices, pairing has no manufacturer verification and can't prevent
an active man-in-the-middle attack. Set it up on a network you trust.
| Command | What it does |
|---|---|
system.run |
Runs a shell command and returns its output and exit code |
file.read |
Reads a file, 64 KB at a time |
file.write |
Writes a file, 64 KB at a time, replacing it only when complete |
device.health |
Reports uptime, load, memory, disk and temperature |
Commands run as the account you installed for, with exactly that account's permissions. If it can use sudo, so can Muse.
Ask Muse things like:
What's using all the disk space on my Pi?
Install Home Assistant on my Pi and tell me how to open it.
Every morning at 7, check if my Pi's backups ran and tell me if they didn't.
Programs on the machine can send messages to Muse, with no credentials of their own:
musegadget send-user-msg "The garage door has been open for an hour."
musegadget send-user-msg --session-id 6f1c2d4e-0b7a-4c3e-9f5d-2a8b1e0c7d93 "Posted to a side chat"--session-id posts into a side chat: a new id starts one, and reusing it
keeps later messages there. examples/pebble_ring_bridge.py
is a complete example: a webhook listener that sends every note from a Pebble
ring to its own Muse chat.
A few other ways to build on it:
- Let Muse do it. Muse can run commands on the machine, so you can ask it to set up the rest: "Write a service that tells me when the Pi gets too hot."
- Add a command. Commands live in
src/musegadget/executor.py: add a spec toCOMMAND_SPECSand a branch inExecutor.run.AGENTS.mdwalks through it. - Build your own gadget. A program on its own hardware can pair, stay
connected and talk to Muse through the
musegadgetpackage.AGENTS.mdlists what it can use. - Change the account.
bash install.sh --run-as someonegives Muse a different account, such as one without sudo. - Change the SDK token.
bash install.sh --sdk-token mgst_…replaces it. It's saved in/var/lib/musegadget/sdk_token, readable only by root. Muse records a device's token only when it pairs, so pair again afterwards withsudo musegadget pair --force. Do the same if you revoke the token the device paired with: it can't reach Muse until it pairs with a new one.
sudo musegadget info # name, node id, SDK token and pairing state
sudo systemctl status musegadget # is it running?
sudo journalctl -u musegadget -f # follow the log
sudo musegadget pair # pair again
bash install.sh --uninstall # remove it (add --purge to forget the pairing)From this directory, with uv:
uv run --with pytest --with . pytestThe tests run anywhere, with no Bluetooth or Muse needed. To try a change on a
device, copy this directory to it and run bash install.sh --from ..
Meet other hackers who are building and customizing Muse gadgets in our community Discord. Get inspired, support each other, and share what you make.
Apache 2.0. See LICENSE.