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.1.tar.gz (24.5 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.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyamaha_yec-0.6.1.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for pyamaha_yec-0.6.1.tar.gz
Algorithm Hash digest
SHA256 7023fb9533d29d19844d6061f669fab1358bc9c21938c431f4c168dc5b017554
MD5 759586d3738c59f4aeaec0e3df594180
BLAKE2b-256 4f947b1b403fc1f42a6673d15ffc1629cab224981b75b526b220460ca9a6dc9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyamaha_yec-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cee14ea924776f98a113502b335c28f0948ef88840644bc039697e2b6a0a49e0
MD5 16319191df084c117017a07f4932f5ef
BLAKE2b-256 2c2e055e4f931f0f469f1f8dbe1f5067656db757a149c28ac16319d726bbdcd6

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