PYAMAHA
About
Pyamaha is Python implementation of Yamaha Extended Control API Specification. Please see Status for list of implemented functions. Undocumented functions will be added in future.
Instalation
pip install pyamaha
or
python setup.py install
Usage
API (with requests)
from pyamaha import Device, System
dev = Device('192.168.1.1')
res = dev.request(System.get_device_info())
print(res.json()) # JSON response
Async API (with aiohttp)
import asyncio
import sys
import aiohttp
from pyamaha import AsyncDevice, System
async def main():
async with aiohttp.ClientSession() as session:
dev = AsyncDevice(session, "192.168.1.1")
res = await dev.request(System.get_device_info())
v = await res.json()
print(v)
# To avoid 'Event loop is closed' RuntimeError due to compatibility issue with aiohttp
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
try:
from asyncio import WindowsSelectorEventLoopPolicy
except ImportError:
pass
else:
if not isinstance(
asyncio.get_event_loop_policy(), WindowsSelectorEventLoopPolicy
):
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())
asyncio.run(main())
UDP Callbacks (see Chaper 10 in YXC documentation)
import time
from pyamaha import Device, System
def handle(message):
print(message) # UDP event data (python dict)
dev = Device('192.168.1.1')
res = dev.request(System.get_device_info(), handle)
print(res.json()) # JSON response
time.sleep(60)
CLI
> python -m pyamaha
yxc>device 192.168.1.106
yxc>system
yxc\system>getDeviceInfo
{u'api_version': 1.17,
u'destination': u'BG',
u'device_id': u'XXX',
u'model_name': u'CD-NT670D',
u'netmodule_checksum': u'XXX',
u'netmodule_version': u'1130 ',
u'operation_mode': u'normal',
u'response_code': 0,
u'system_id': u'XXX',
u'system_version': 1.7,
u'update_error_code': u'FFFFFFFF'}
yxc\system>
Status
| Function | API | CLI | Info |
|---|---|---|---|
| SYSTEM | |||
| /YamahaExtendedControl/v1/system/getDeviceInfo | x | x | Documented |
| /YamahaExtendedControl/v1/system/getFeatures | x | x | Documented |
| /YamahaExtendedControl/v1/system/getNetworkStatus | x | x | Documented |
| /YamahaExtendedControl/v1/system/getFuncStatus | x | x | Documented |
| /YamahaExtendedControl/v1/system/setAutoPowerStandby | x | x | Documented |
| /YamahaExtendedControl/v1/system/getLocationInfo | x | x | Documented |
| /YamahaExtendedControl/v1/system/sendIrCode | x | x | Documented |
| /YamahaExtendedControl/v1/system/setWiredLan | x | x | Documented |
| /YamahaExtendedControl/v1/system/setWirelessLan | x | - | Documented |
| /YamahaExtendedControl/v1/system/setWirelessDirect | x | - | Documented |
| /YamahaExtendedControl/v1/system/setIpSettings | x | - | Documented |
| /YamahaExtendedControl/v1/system/setNetworkName | x | - | Documented |
| /YamahaExtendedControl/v1/system/setAirPlayPin | x | - | Documented |
| /YamahaExtendedControl/v1/system/getMacAddressFilter | x | - | Documented |
| /YamahaExtendedControl/v1/system/setMacAddressFilter | x | - | Documented |
| /YamahaExtendedControl/v1/system/getNetworkStandby | x | - | Documented |
| /YamahaExtendedControl/v1/system/setNetworkStandby | x | - | Documented |
| /YamahaExtendedControl/v1/system/getBluetoothInfo | x | - | Documented |
| /YamahaExtendedControl/v1/system/setBluetoothStandby | x | - | Documented |
| /YamahaExtendedControl/v1/system/setBluetoothTxSetting | x | - | Documented |
| /YamahaExtendedControl/v1/system/getBluetoothDeviceList | x | - | Documented |
| /YamahaExtendedControl/v1/system/updateBluetoothDeviceList | x | - | Documented |
| /YamahaExtendedControl/v1/system/connectBluetoothDevice | x | - | Documented |
| /YamahaExtendedControl/v1/system/disconnectBluetoothDevice | x | - | Documented |
| /YamahaExtendedControl/v1/system/setSpeakerA | x | - | Documented |
| /YamahaExtendedControl/v1/system/setSpeakerB | x | - | Documented |
| /YamahaExtendedControl/v1/system/setDimmer | x | - | Documented |
| /YamahaExtendedControl/v1/system/setZoneBVolumeSync | x | - | Documented |
| /YamahaExtendedControl/v1/system/setHdmiOut1 | x | - | Documented |
| /YamahaExtendedControl/v1/system/setHdmiOut2 | x | - | Documented |
| /YamahaExtendedControl/v1/system/getNameText | x | - | Documented |
| /YamahaExtendedControl/v1/system/setNameText | x | - | Documented |
| /YamahaExtendedControl/v1/system/setSpeakerPattern | x | - | Documented |
| /YamahaExtendedControl/v1/system/setPartyMode | x | - | Documented |
| ZONE | |||
| /YamahaExtendedControl/v1/{zone}/getStatus | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/getSoundProgramList | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setPower | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setSleep | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setVolume | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setMute | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setInput | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setSoundProgram | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/prepareInputChange | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/set3dSurround | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setDirect | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setPureDirect | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setEnhancer | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setToneControl | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setEqualizer | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setBalance | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setDialogueLevel | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setDialogueLift | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setClearVoice | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setSubwooferVolume | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setBassExtension | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/getSignalInfo | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setLinkControl | x | - | Documented |
| /YamahaExtendedControl/v1/{zone}/setLinkAudioDelay | x | - | Documented |
| TUNER | |||
| /YamahaExtendedControl/v1/tuner/getPresetInfo | x | - | Documented |
| /YamahaExtendedControl/v1/tuner/getPlayInfo | x | - | Documented |
| /YamahaExtendedControl/v1/tuner/setFreq | x | - | Documented |
| /YamahaExtendedControl/v1/tuner/recallPreset | x | - | Documented |
| /YamahaExtendedControl/v1/tuner/switchPreset | x | - | Documented |
| /YamahaExtendedControl/v1/tuner/storePreset | x | - | Documented |
| /YamahaExtendedControl/v1/tuner/setDabService | x | - | Documented |
| NETWORK/USB | |||
| /YamahaExtendedControl/v1/netusb/getPresetInfo | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/getPlayInfo | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/setPlayback | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/toggleRepeat | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/toggleShuffle | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/getListInfo | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/setListControl | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/setSearchString | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/recallPreset | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/storePreset | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/getAccountStatus | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/switchAccount | x | - | Documented |
| /YamahaExtendedControl/v1/netusb/getServiceInfo | x | - | Documented |
| CD | |||
| /YamahaExtendedControl/v1/cd/getPlayInfo | x | - | Documented |
| /YamahaExtendedControl/v1/cd/setPlayback | x | - | Documented |
| /YamahaExtendedControl/v1/cd/toggleTray | x | - | Documented |
| /YamahaExtendedControl/v1/cd/toggleRepeat | x | - | Documented |
| /YamahaExtendedControl/v1/cd/toggleShuffle | x | - | Documented |
| DIST | |||
| /YamahaExtendedControl/v1/dist/getDistributionInfo | x | - | Documented |
| /YamahaExtendedControl/v1/dist/setServerInfo | x | - | Documented |
| /YamahaExtendedControl/v1/dist/setClientInfo | x | - | Documented |
| /YamahaExtendedControl/v1/dist/startDistribution | x | - | Documented |
| /YamahaExtendedControl/v1/dist/stopDistribution | x | - | Documented |
| /YamahaExtendedControl/v1/dist/setGroupName | x | - | Documented |
| CLOCK | |||
| /YamahaExtendedControl/v1/clock/getSettings | x | - | Documented |
| /YamahaExtendedControl/v1/clock/setAutoSync | x | - | Documented |
| /YamahaExtendedControl/v1/clock/setDateAndTime | x | - | Documented |
| /YamahaExtendedControl/v1/clock/setClockFormat | x | - | Documented |
| /YamahaExtendedControl/v1/clock/setAlarmSettings | x | - | Documented |
License
Code is released under MIT license © Radoslaw '[rsc]' Matusiak.
Release files for pyamaha-yec 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyamaha_yec-0.7.0.tar.gz | 24.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyamaha_yec-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.9 kB
Release files / pyamaha_yec-0.7.0.tar.gz
| Download URL | pyamaha_yec-0.7.0.tar.gz |
|---|---|
| Size | 24.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffdbac0e9019d3ef97275688b3ec96c29463a64545a64ce9224746fbd32d53eb
|
|
BLAKE2b-256 checksum How to use checksums |
6bf92af48337f6229e929b576f3bba304c39e4c3687b870295d65712aad13003
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pyamaha_yec-0.7.0-py3-none-any.whl
| Download URL | pyamaha_yec-0.7.0-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d55513a0fbc600021547a78fb2e23ed5f142d15f929388bf8d6b4d649660b93
|
|
BLAKE2b-256 checksum How to use checksums |
9db0e4e66beadb3249cd64ee5424ad9154d0bec1f432388dc76d090c1d0a656e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|