Python client and CLI for Naim Mu-so 2nd Gen (unofficial).
Project description
pynaim
pynaim is a Python library and CLI tool to control Naim Uniti and Mu-so audio devices via their HTTP API. It provides methods for power control, playback, volume adjustment, source selection, and fetching device information.
The package is tested on an Naim Mu-so 2nd Generation, but should also work on at least some Uniti products. If you run into problems, please let me know.
Features
- Power control: turn the device on/off
- Playback control: play, pause, stop, next/previous track, play/pause toggle
- Volume control: set, increase, decrease, mute, unmute
- Source selection: choose input source
- Query device information: diagnostics, favorites, network, now playing, volume levels, power state
- Asynchronous event stream support for real-time notifications (work in progress)
- Command-line interface (CLI) for quick control from terminal
Installation
Install via PyPI:
pip install pynaim
Usage in Python
import asyncio
from pynaim import NaimController
controller = NaimController(host="192.168.1.100")
controller.turn_on()
controller.media_play()
controller.volume_up()
print(controller.get_now_playing())
CLI Usage
Once installed, you can use the pynaim CLI:
# Set default host
pynaim set_host --host 192.168.1.100
# Power control
pynaim power on
pynaim power off
# Playback control
pynaim play
pynaim pause
pynaim stop
pynaim playpause
pynaim next
pynaim previous
# Volume control
pynaim volume up
pynaim volume down
pynaim volume mute
pynaim volume unmute
pynaim volume level 25
Use
--verbosityflag for more detailed logging.
Event Stream
async def main():
controller = NaimController(host="192.168.1.100")
await controller.event_stream()
asyncio.run(main())
⚠️ Event stream implementation is in progress; it handles reconnects but requires improved error handling.
Methods
Power
turn_on()turn_off()get_power()
Playback
media_play()media_pause()media_stop()media_play_pause()media_next_track()media_previous_track()get_now_playing()get_artist()get_title()get_album()get_artwork()
Volume
volume_up()volume_down()volume_set(volume: int)volume_mute()volume_unmute()get_levels()
Inputs / Sources
select_source(source_path: str)get_inputs()get_selectable_inputs()
Device Info
get_diagnostics()get_favourites()get_network()get_update()
Logging
pynaim uses Python's built-in logging module. Default level is INFO, HTTPX logs are set to WARNING.
import logging
logging.basicConfig(level=logging.INFO)
Notes
- Some methods use synchronous HTTP requests (
httpx.request) for simplicity. - Event streaming is asynchronous and requires
asyncio. - Volume up/down fetches current volume; future updates may cache the value.
- Source selection does not currently validate against available inputs.
- CLI stores default host in
~/.config/pynaim/config.json.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynaim-0.1.2.tar.gz.
File metadata
- Download URL: pynaim-0.1.2.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9219401b75df4580d0b199c84eec2c8f48ab6e72c2aeccf0d5b94925c0600af4
|
|
| MD5 |
658f1a422313cf7e9b045e40c85eb6b0
|
|
| BLAKE2b-256 |
2277a3904fb30979039857a6f1a661ea5e8912e285bccf2f9c4afe41857eeff7
|
Provenance
The following attestation bundles were made for pynaim-0.1.2.tar.gz:
Publisher:
publish.yml on blaauboer/pynaim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynaim-0.1.2.tar.gz -
Subject digest:
9219401b75df4580d0b199c84eec2c8f48ab6e72c2aeccf0d5b94925c0600af4 - Sigstore transparency entry: 454470876
- Sigstore integration time:
-
Permalink:
blaauboer/pynaim@d50243d74dc4be2ed35cbd779218ee468364ab8e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/blaauboer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d50243d74dc4be2ed35cbd779218ee468364ab8e -
Trigger Event:
push
-
Statement type:
File details
Details for the file pynaim-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pynaim-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d05abee26f205b091bf32c94249e8e71e20b0b0227e7d939cd7d30f151e8d5e
|
|
| MD5 |
603f6d0106ecea66e56905879c5bae1e
|
|
| BLAKE2b-256 |
fad88f51778b597aa25a49644bee2b80577b98045e45deb4f582247a5bf6bc31
|
Provenance
The following attestation bundles were made for pynaim-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on blaauboer/pynaim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynaim-0.1.2-py3-none-any.whl -
Subject digest:
7d05abee26f205b091bf32c94249e8e71e20b0b0227e7d939cd7d30f151e8d5e - Sigstore transparency entry: 454470879
- Sigstore integration time:
-
Permalink:
blaauboer/pynaim@d50243d74dc4be2ed35cbd779218ee468364ab8e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/blaauboer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d50243d74dc4be2ed35cbd779218ee468364ab8e -
Trigger Event:
push
-
Statement type: