Skip to main content

Automation control library for Yamaha receivers that support the YNCA protocol.

Project description

YNCA

Automation Library for Yamaha receivers that support the YNCA protocol.

Supported receivers according to protocol documentation (not all tested) or logs found on the internet. There might be more receivers that support this protocol. If you find some let met know so the list can be updated.

RX-A700, RX-A710, RX-A720, RX-A800, RX-A810, RX-A820, RX-A840, RX-A850, RX-A1000, RX-A1010, RX-A1020, RX-A1040, RX-A2000, RX-A2010, RX-A2020, RX-A3000, RX-A3010, RX-A3020, RX-V671, RX-V867, RX-V871, RX-V1067, RX-V2067, RX-V2600, RX-V3067

Installation

python3 -m pip install ynca

Contents

This package contains:

Ynca class

The Ynca class is exposing the YNCA API as defined in the specification and allows to connect to devices supporting that API.

get_inputinfo_list _list helper function

This helper gets a list of all the inputs available on the device from the Ynca API to be used with the inputs on the Zone subunits. It is provided as a convenience because it is a bit tricky to build that list.

Get_modelinfo helper function

Gets info specific to a certain model that can otherwise not be determined through YNCA (e.g. supported SoundPrg)

YNCA Terminal

The YNCA Terminal provides an interactive terminal for YNCA commands intended for debugging. Examples on how to start below.

python3 -m ynca.terminal /dev/ttyUSB0
python3 -m ynca.terminal socket://192.168.178.21:50000

YNCA Server

Not part of the installed package, but available in the repo there is a very basic YNCA server intended for debugging and testing without connecting to a real device. Check the commandline help of ynca_server.py for more details.

Example usage

# Create a Ynca class by specifying the port on your receiver.
# Port could also be e.g. COM3 on Windows or any `serial_url` as supported by PySerial
# Like for example `socket://192.168.1.12:50000` for IP connection
ynca_receiver = Ynca("/dev/tty1")

# Initializing takes a while (multiple seconds) since it communicates
# quite a lot with the actual device to determine its capabilities.
# Later calls to the subunits are fast.
# Note that attributes that are still None after initialization are not supported by the subunits
ynca_receiver.initialize()

# Every subunit has a dedicated attribute on the `Ynca` class.
# The name is the subunit id as used in YNCA.
# The returned subunit class can be used to communicate with the subunit
sys = ynca_receiver.SYS
main = ynca_receiver.MAIN

print(sys.modelname) # Print the modelname of the system
print(main.zonename) # Print the name of the main zone

# The `get_inputinfo_list` helper returns a list of available inputs.
# It has the `input` to be used with the INP function in YNCA,
# `subunit` if the input is associated with a subunit, e.g. Tuner/TUN
# and `name ` with user provided name if available, otherwise `input`.
#
# Note that not all inputs will be available to all zones, but
# it is not possible to derive this from the API
for input_info in get_inputinfo_list(ynca_receiver).items():
    print(f"{input_info.subunit=}, {input_info.input=}, {input_info.name=}")

# To get notifications when something changes register callback with the subunit
# Note that callbacks are called from a different thread and also should not block for too long.
def update_callback():
    print("Something was updated on the MAIN subunit")

main.register_update_callback(update_callback)

# Examples to control a zone
main.pwr = True
main.mute = Mute.off
main.inp = "HDMI3"
main.vol = -50.5
main.vol_up()

# When done call close for proper shutdown
ynca_receiver.close()

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

ynca-3.8.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

ynca-3.8.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file ynca-3.8.0.tar.gz.

File metadata

  • Download URL: ynca-3.8.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for ynca-3.8.0.tar.gz
Algorithm Hash digest
SHA256 c8438e416370587e8d119df5df245394dd4f64174c75e72c20b0ef112624621c
MD5 9767f77becf195f78e6c16ab2ef8bb58
BLAKE2b-256 a888a768641652548a3be08992020b2219f2844ee213b5723b39900fb695c6a7

See more details on using hashes here.

File details

Details for the file ynca-3.8.0-py3-none-any.whl.

File metadata

  • Download URL: ynca-3.8.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for ynca-3.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2db3ff8eab3bde8d92a7610d25da09a9370be76115c6cbb133356a725bf74d88
MD5 e551f5baf47e14c6741891d5fc138636
BLAKE2b-256 145d7a3eae7f9296e1867ac9291b918bba374ef2733a6c6a7b468848fb836b4c

See more details on using hashes here.

Supported by

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