/
/
# What does this implement/fix? When a HEOS-connected AVR is fully power-cycled, pyheos internally marks the device as unavailable, but Music Assistant was not listening for the disconnection event. This left the player showing as available in MA while the underlying transport connection was gone, causing every playback command to fail with `CommandError: Not connected to device` until the MA addon was restarted. The fix subscribes to pyheos's `add_on_disconnected` callback in `_setup_controllers`. When the callback fires, `set_device_info()` is called on each registered HEOS player, which reads the (now-False) `available` attribute from the pyheos device object and propagates it via `update_state()`. Recovery on reconnection was already handled correctly: pyheos fires `EVENT_PLAYERS_CHANGED` with a `PlayerUpdateResult` after reloading players, which triggers the existing `_handle_controller_event` → `discover_players()` path. **Related issue (if applicable):** - related issue https://github.com/music-assistant/support/issues/5565 ## Types of changes - [x] Bugfix (non-breaking change which fixes an issue) — `bugfix` ## Checklist - [ ] The code change is tested and works locally. - [x] `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. - [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 targeting the main or beta branch as appropriate. --- _Generated by [Claude Code](https://claude.ai/code/session_01RCxBC9UUetxpuHWMZv8vF1)_ Co-authored-by: Claude <[email protected]>