Skip to content

Pair Sendspin players on the Home Assistant host with their local token - #7315

Merged
chrisuthe merged 2 commits into
devfrom
chrisuthe/task/pair-co-located-sendspin-players-from-their-local
Nov 2, 2026
Merged

chrisuthe merged 2 commits into
devfrom
chrisuthe/task/pair-co-located-sendspin-players-from-their-local

Conversation

@chrisuthe

@chrisuthe chrisuthe commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

What does this implement/fix?

A Sendspin player running on the same HAOS host as the Music Assistant add-on (the Local Audio app) now pairs automatically, with no token copying. This replaces the route through Home Assistant: its HA-side support (home-assistant/core#188845, #7240) was closed, so the HassAutoPairer and the hass provider's subscribe_sendspin_clients / get_sendspin_pairing_token are removed.

How it works:

  • The player lists the application-specific role _ma_local_pairing@v1 (provisional name) in client/hello and sends "_ma_local_pairing@v1_support": {"port": N}.
  • When it connects encrypted and unpaired, offering the token pair method, and no manual pairing is running, MA fetches GET http://172.30.32.1:N/ (plain-text token). It then pairs through pair_with_token, which rejects a token for another client id.
  • The address is fixed, never taken from the client. The port must be an int in 1024-65535. The fetch uses mass.http_session with a 5 s timeout, no redirects, 200 only and a 512-byte cap. The token is never logged.
  • Only active when running as the HA add-on, behind a hidden local_pairing entry (default on), like allow_legacy_clients.

No same-host check in this version: aiosendspin exposes no public peer address. A client cannot pair this way without the PSK, because the handshake fails, so the check would only stop other hosts from triggering the local fetch.

If a proxy is set via HTTP(S)_PROXY without NO_PROXY covering 172.30.32.1, the fetch goes through it, because mass.http_session honours proxy env vars.

Depends on Sendspin/aiosendspin#586 (hello keeps application_objects). The aiosendspin[server]==10.2.1 pin still has to be bumped once that is released; until then mypy fails in CI.

Related issue (if applicable):

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • New music/player/metadata/plugin provider — new-provider
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — documentation
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Checklist

  • The code change is tested and works locally.
  • pre-commit run --all-files passes.
  • pytest passes, and tests have been added/updated under tests/ where applicable.
  • For changes to shared models, the companion PR in music-assistant/models is linked.
  • For changes affecting the UI, the companion PR in music-assistant/frontend is linked.
  • I have read and complied with the project's AI Policy for any AI-assisted contributions.
  • I have raised a PR against the documentation repository targeting the main or beta branch as appropriate.

@musicassistant-bot

musicassistant-bot Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ The title and description are good to go. Thanks!

A player next to the add-on announces `_ma_local_pairing@v1` with a port in its
hello; fetch its token from the host side of the hassio network and pair with it.
This replaces the route through Home Assistant, whose HA-side support was dropped.
@chrisuthe
chrisuthe force-pushed the chrisuthe/task/pair-co-located-sendspin-players-from-their-local branch from 88eecc0 to 9a225e5 Compare November 2, 2026 14:22
@codspeed

codspeed Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 11 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing chrisuthe/task/pair-co-located-sendspin-players-from-their-local (8ae14bf) with dev (724a425)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🔒 Dependency Security Report

📦 Modified Dependencies

music_assistant/providers/sendspin/manifest.json

Added:

Removed:

Unchanged dependencies
  • av ==18.1.0

The following dependencies were added or modified:

diff --git a/requirements_all.txt b/requirements_all.txt
index 7ae57708d..dfed0b865 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -13,7 +13,7 @@ aiohttp-socks==0.12.0
 aiojellyfin==0.14.1
 aiolibdatachannel @ git+https://github.com/music-assistant/aiolibdatachannel@feat/certpem-testdrive
 aiomusiccast==0.15.0
-aiosendspin[server]==10.2.2
+aiosendspin[server]==10.3.0
 aioslimproto==3.3.0
 aiosonos==0.1.15
 aiosqlite==0.22.1

New/modified packages to review:

  • aiosendspin[server]==10.3.0

🔍 Vulnerability Scan Results

No known vulnerabilities found

Name Skip Reason
aiolibdatachannel Dependency not found on PyPI and could not be audited: aiolibdatachannel (2026.5.23.dev4+g950e7f0)
torch Dependency not found on PyPI and could not be audited: torch (2.13.0+cpu)
torchaudio Dependency not found on PyPI and could not be audited: torchaudio (2.11.0+cpu)
yappi Dependency not found on PyPI and could not be audited: yappi (1.7.7)

✅ No known vulnerabilities found


Automated Security Checks

  • ✅ Vulnerability Scan: Passed - No known vulnerabilities
  • ✅ Trusted Sources: All packages have verified source repositories
  • ✅ Typosquatting Check: No suspicious package names detected
  • ✅ License Compatibility: All licenses are OSI-approved and compatible
  • ✅ Supply Chain Risk: Passed - packages appear mature and maintained

Manual Review

Maintainer approval required:

  • I have reviewed the changes above and approve these dependency updates

To approve: Comment /approve-dependencies or manually add the dependencies-reviewed label.

@chrisuthe chrisuthe added the dependencies-reviewed Indication that any added or modified/updated dependencies on a PR have been reviewed label Nov 2, 2026
@chrisuthe
chrisuthe marked this pull request as ready for review November 2, 2026 16:06
@chrisuthe
chrisuthe merged commit 3556a56 into dev Nov 2, 2026
31 checks passed
@chrisuthe
chrisuthe deleted the chrisuthe/task/pair-co-located-sendspin-players-from-their-local branch November 2, 2026 16:41
chrisuthe added a commit that referenced this pull request Nov 4, 2026
acuntex pushed a commit to acuntex/music-assistant-server that referenced this pull request Nov 19, 2026
…en (music-assistant#7371)

# What does this implement/fix?

A software Sendspin player running on the same HAOS host as the Music
Assistant add-on (the Local Audio app) now pairs automatically, with no
token copying. This is music-assistant#7315 again without the part that got it reverted
(music-assistant#7370): the Home Assistant ESPHome auto-pairing (`HassAutoPairer` and
the hass provider's `subscribe_sendspin_clients` /
`get_sendspin_pairing_token`) stays as it is. The two cover different
players: ESPHome devices pair through Home Assistant, software players
through their local token.

How it works:
- The player lists the application-specific role `_ohf_local_pairing@v1`
(provisional name, with the `ohf_` prefix asked for on
Sendspin/backlog#86) in `client/hello` and sends
`"_ohf_local_pairing@v1_support": {"port": N}`.
Sendspin/sendspin-cpp-cli#110 is the player side.
- When it connects encrypted and unpaired, offering the token pair
method, and no manual pairing is running, MA fetches `GET
http://172.30.32.1:N/` (plain-text token). It then pairs through
`pair_with_token`, which rejects a token for another client id.
- The address is fixed, never taken from the client. The port must be an
int in 1024-65535. The fetch uses `mass.http_session` with a 5 s
timeout, no redirects, 200 only and a 512-byte cap. The token is never
logged.
- Only active when running as the HA add-on, behind a hidden
`local_pairing` entry (default on), like `allow_legacy_clients`.

No same-host check in this version: aiosendspin exposes no public peer
address. A client cannot pair this way without the PSK, because the
handshake fails, so the check would only stop other hosts from
triggering the local fetch.

If a proxy is set via `HTTP(S)_PROXY` without `NO_PROXY` covering
`172.30.32.1`, the fetch goes through it, because `mass.http_session`
honours proxy env vars.

Bumps `aiosendspin[server]` to 10.3.0, which keeps `application_objects`
on the hello (Sendspin/aiosendspin#586).

**Related issue (if applicable):**

- related issue Sendspin/backlog#86
- reverted earlier version: music-assistant#7315, music-assistant#7370

## Types of changes

- [ ] Bugfix (non-breaking change which fixes an issue) — `bugfix`
- [x] New feature (non-breaking change which adds functionality) —
`new-feature`
- [ ] Enhancement to an existing feature — `enhancement`
- [ ] New music/player/metadata/plugin provider — `new-provider`
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected) — `breaking-change`
- [ ] Refactor (no behaviour change) — `refactor`
- [ ] Documentation only — `documentation`
- [ ] Maintenance / chore — `maintenance`
- [ ] CI / workflow change — `ci`
- [ ] Dependencies bump — `dependencies`

## Checklist

- [x] The code change is tested and works locally.
- [x] `pre-commit run --all-files` passes.
- [x] `pytest` passes, and tests have been added/updated under `tests/`
where applicable.
- [ ] For changes to shared models, the companion PR in
`music-assistant/models` is linked.
- [ ] For changes affecting the UI, the companion PR in
`music-assistant/frontend` is linked.
- [x] I have read and complied with the project's [AI
Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md)
for any AI-assisted contributions.
- [ ] I have [raised a PR against the documentation
repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md)
targeting the main or beta branch as appropriate.

---------

Co-authored-by: Artur Pragacz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies-reviewed Indication that any added or modified/updated dependencies on a PR have been reviewed new-feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant