brainstate

Darkatek7/SonosControl · source

Snapshot 0 · 2026-11-04T12:47:27Z · C# ·

Content fingerprint50a5060d0833667696cba94e81d7c7b69cacd54deffcde380029d0ae3be140c5

GitHub description at capture

Self-hosted Sonos control and automation dashboard for multi-room playback, scenes, schedules, favourites, Radio, Spotify, YouTube, device management, and listening insights.

README at capture

# SonosControl - Self-Hosted Sonos Automation Dashboard
[![Dockerhub](https://github.com/Darkatek7/SonosControl/actions/workflows/dockerhubpush.yml/badge.svg)](https://github.com/Darkatek7/SonosControl/actions/workflows/dockerhubpush.yml)

SonosControl is a deployer-friendly Blazor control centre organised around everyday playback, a unified source library, schedule-based automation, listening insights, and role-aware administration.

![SonosControl playback dashboard in dark theme](docs/assets/readme/images/desktop-dark-home.png)

## Quick Start

### 1. Run with Docker Compose

```yaml
services:
  sonos:
    build:
      context: .
      dockerfile: Dockerfile
    image: sonoscontrol:local
    container_name: sonoscontrol
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      TZ: Europe/Vienna
      ADMIN_USERNAME: admin
      ADMIN_EMAIL: admin@example.com
      ADMIN_PASSWORD: ChangeMe123!
      PLAYBACK_PUBLIC_BASE_URL: http://192.168.1.50:8080
      FlyDj__Enabled: ${FLYDJ_ENABLED:-false}
      FlyDj__ServiceUrl: http://flydj:8090
      FlyDj__SharedSecret: ${FLYDJ_SHARED_SECRET:-}
    volumes:
      - ./Data:/app/Data
      - ./DataProtectionKeys:/app/DataProtectionKeys
      - ./artifacts:/app/artifacts

  # Optional experimental FlyDJ sidecar. Stays stopped (exit 0) unless FLYDJ_ENABLED=true.
  flydj:
    build:
      context: ./flydj
      dockerfile: Dockerfile
    image: sonoscontrol-flydj:local
    container_name: sonoscontrol-flydj
    restart: on-failure
    expose:
      - "8090"
    environment:
      TZ: ${TZ:-Europe/Vienna}
      FLYDJ_ENABLED: ${FLYDJ_ENABLED:-false}
      FLYDJ_CONNECTOME_SCOPE: ${FLYDJ_CONNECTOME_SCOPE:-auditory}
      FLYDJ_SIM_SPEED: ${FLYDJ_SIM_SPEED:-1.0}
      FLYDJ_SHARED_SECRET: ${FLYDJ_SHARED_SECRET:-}
    cpus: ${FLYDJ_CPUS:-1.0}
    mem_limit: ${FLYDJ_MEM_LIMIT:-512m}
```

```bash
cp .env.example .env
docker compose up -d --build
```

Open `http://localhost:8080` and sign in with the seeded admin account.
Set `PLAYBACK_PUBLIC_BASE_URL` to the LAN URL that your Sonos devices can reach. `localhost` does not work for YouTube or uploaded MP3 audio streaming to Sonos.
The core app runs without the FlyDJ sidecar; leave `FLYDJ_ENABLED` at `false` to keep it stopped. See [FlyDJ (optional, experimental)](docs/deploy-and-config.md#flydj-optional-experimental) to enable it.

### 2. Run locally with .NET 10

PowerShell:
```powershell
dotnet restore
Copy-Item SonosControl.Web/Data/config.template.json SonosControl.Web/Data/config.json -ErrorAction SilentlyContinue
dotnet run --project SonosControl.Web --urls http://localhost:5107
```

Bash:
```bash
dotnet restore
cp -n SonosControl.Web/Data/config.template.json SonosControl.Web/Data/config.json
dotnet run --project SonosControl.Web --urls http://localhost:5107
```

Then open `http://localhost:5107`.

## Screenshot Gallery

### Desktop · Light

| Home | Library | Automation | Insights | Administration |
|---|---|---|---|---|
| ![Desktop light home](docs/assets/readme/images/desktop-light-home.png) | ![Desktop light library](docs/assets/readme/images/desktop-light-library.png) | ![Desktop light automation](docs/assets/readme/images/desktop-light-automation.png) | ![Desktop light insights](docs/assets/readme/images/desktop-light-insights.png) | ![Desktop light administration](docs/assets/readme/images/desktop-light-administration.png) |

### Desktop · Dark

| Home | Library | Automation | Insights | Administration |
|---|---|---|---|---|
| ![Desktop dark home](docs/assets/readme/images/desktop-dark-home.png) | ![Desktop dark library](docs/assets/readme/images/desktop-dark-library.png) | ![Desktop dark automation](docs/assets/readme/images/desktop-dark-automation.png) | ![Desktop dark insights](docs/assets/readme/images/desktop-dark-insights.png) | ![Desktop dark administration](docs/assets/readme/images/desktop-dark-administration.png) |

### Mobile · Light

| Home | Library | Automation | Insights | Administration |
|---|---|---|---|---|
| ![Mobile light home](docs/assets/readme/images/mobile-light-home.png) | ![Mobile light library](docs/assets/readme/images/mobile-light-library.png) | ![Mobile light automation](docs/assets/readme/images/mobile-light-automation.png) | ![Mobile light insights](docs/assets/readme/images/mobile-light-insights.png) | ![Mobile light administration](docs/assets/readme/images/mobile-light-administration.png) |

### Mobile · Dark

| Home | Library | Automation | Insights | Administration |
|---|---|---|---|---|
| ![Mobile dark home](docs/assets/readme/images/mobile-dark-home.png) | ![Mobile dark library](docs/assets/readme/images/mobile-dark-library.png) | ![Mobile dark automation](docs/assets/readme/images/mobile-dark-automation.png) | ![Mobile dark insights](docs/assets/readme/images/mobile-dark-insights.png) | ![Mobile dark administration](docs/assets/readme/images/mobile-dark-administration.png) |

## Feature Highlights

- Focused first-speaker onboarding, with the playback dock appearing after a room is configured.
- Responsive Home player plus a compact sticky mini-player with queue, room, group, sync, timer, and coalesced volume controls.
- One Library for saved TuneIn, Spotify, YouTube, and YouTube Music sources, with link examples, field validation, Radio Browser discovery, and recommendations.
- Home Quick access lists favourites first and labels suggested sources.
- Temporary MP3 uploads in Library with immediate speaker playback and configurable automatic deletion.
- One Schedules surface: each entry embeds its own source, speakers, per-room volume, and synced playback. Entries without a time can be saved as manual templates and started with Start now.
- Ordered recurring schedules with date exceptions, fades, and automatic migration from legacy scenes and day-based automation.
- Per-speaker daily auto-stop rules with a grace period for manual playback, shown on room cards and the player.
- Mobile fullscreen editors keep save actions visible and protect unsaved drafts when closing or navigating.
- Role-based access (`operator`, `admin`, `superadmin`) with registration control.
- Responsive listening statistics and a searchable read-only activity trail.
- Separate administration areas for devices, system settings, users, and recoverable configuration backups.
- Live speaker updates through UPnP events, so changes from the Sonos app or the speaker buttons appear within about a second; speakers that cannot send events keep polling.
- Health and metrics endpoints (`/healthz`, `/metricsz`) for basic monitoring.
- Docker image includes `ffmpeg` and `yt-dlp` for YouTube audio playback. The core app needs no extra sidecar containers.
- Optional, experimental FlyDJ: an autonomous radio DJ driven by a fruit-fly connectome simulation, running as its own `flydj` container and off by default. It chooses only between your library's radio stations and always yields to manual control.

## Docs Index
- [Deploy and Config Guide](docs/deploy-and-config.md)
- [FlyDJ (optional, experimental)](docs/deploy-and-config.md#flydj-optional-experimental)
- [Docker Operations](docs/docker-operations.md)
- [Operations and Observability](docs/operations-and-observability.md)
- [Testing and Troubleshooting](docs/testing-and-troubleshooting.md)
- [Warning triage notes](docs/quality-warning-triage.md)
- [Changelog](CHANGELOG.md)
- [Contributing Guide](CONTRIBUTING.md)

## Contributing
Contribution workflow, README asset maintenance, and screenshot refresh instructions are documented in [CONTRIBUTING.md](CONTRIBUTING.md).

## License
SonosControl is released under the [Don't Be a Dick Public License](LICENSE.md).

## Useful Links
- Docker Hub: https://hub.docker.com/r/darkatek7/sonoscontrol
- ByteDev.Sonos: https://github.com/ByteDev/ByteDev.Sonos
- Radio Browser: https://www.radio-browser.info/
- ASP.NET Core docs: https://learn.microsoft.com/aspnet/core