Skip to main content

Python implementation of Yamaha Extended Control API Specification

Project description

PYAMAHA

PyPI Join the chat at https://gitter.im/rsc-dev/pyamaha Unit Tests

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyamaha_yec-0.6.4.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyamaha_yec-0.6.4-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file pyamaha_yec-0.6.4.tar.gz.

File metadata

  • Download URL: pyamaha_yec-0.6.4.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}

File hashes

Hashes for pyamaha_yec-0.6.4.tar.gz
Algorithm Hash digest
SHA256 33c879491d3af4a3ce0efb77302fe32e3b460ede44ca68a7b9e29955f5ac5846
MD5 5b1df745c94f7031d237b1a12b71be7b
BLAKE2b-256 00247cac274a760b4ca755a0a8d840da2f6d278462605dae5c66bb6656325cbd

See more details on using hashes here.

File details

Details for the file pyamaha_yec-0.6.4-py3-none-any.whl.

File metadata

  • Download URL: pyamaha_yec-0.6.4-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}

File hashes

Hashes for pyamaha_yec-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8d1d70b8dbba2acbe0c1cdd750b056cd00402d8c1b726e7434b22a0dc88e5451
MD5 62922faee6fd9b93b7f8c595ba87e3a3
BLAKE2b-256 bd98fd621d6e047f3452695609d63451bd76e26c0795dc5ad95d7afe090ce9a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page