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-A800, RX-A810, RX-A840, RX-A850, RX-A1000, RX-A1010, RX-A1040, RX-A2000, RX-A2010, RX-A3000, RX-A3010, 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_all_zone_inputs 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.
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
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 receiver and subunits are fast.
# Note that attributes that are still None after initialization are not supported by the subunits
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 = receiver.SYS
main = receiver.MAIN
print(sys.modelname) # Print the modelname of the system
print(main.name) # Print the name of the main zone
# The `get_all_zone_inputs` helper returns a dictionary of available inputs
# with the key being the ID to be used for setting the input on a Zone subunit
# and the value the friendly name (user provided one if available).
# Note that not all inputs might be available to all zones, but
# it is not possible to derive this from the API
for id, name in get_all_zone_inputs(receiver).items():
print(f"input {id}: {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.input = "HDMI3"
main.volume = -50.5
main.volume_up()
# When done call close for proper shutdown
receiver.close()
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
File details
Details for the file ynca-3.2.2.tar.gz
.
File metadata
- Download URL: ynca-3.2.2.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f28f7b2d7b00507b26200ea18ba1ac666d62e1aa2608012e7c20b02b7795f37 |
|
MD5 | 8747e516c6432d8a3b1bc1ae341cd782 |
|
BLAKE2b-256 | baa3f3f977d954c244a2e6d3b6e02ba609a79762844f2a5b71d9ad49f8c6b813 |
File details
Details for the file ynca-3.2.2-py3-none-any.whl
.
File metadata
- Download URL: ynca-3.2.2-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe42682bf839a974bd3f05c1122415a1fd40a5d2f09b5aa8b1c4431b3681e974 |
|
MD5 | d1b0e1a9347e1aa59671a0a79b012758 |
|
BLAKE2b-256 | 000f3cfd1fedc02e8a0585776375d5483bd3992f017e41f864d73d129361989c |