Package: aiopioneer
Python library for controlling a Pioneer AVI via its built-in API.Used by thepioneer_asyncintegration for Home Assistant, which was inspired by theoriginal Pioneer Home Assistant integration.
Tested on a VSX-930 (Main Zone and HDZone outputs).FeaturesImplemented in asyncio.Maintains single continuous telnet session to AVR, with automatic reconnect.Eliminates status polling where AVR sends keepalive responses (on port 8102).Auto-detects Zones 1, 2, 3 and HDZONE.Automatically polls AVR for source names - no longer need to manually code them in your config any more if your AVR supports their retrieval. Can also set source names manually.Ignore specific zones, for AVRs that report phantom zones.Queries device parameters: MAC address, software version, model.Ability to set internal parameters to change the API functionality, eg. maximum volume, volume step change delta.Defaults for internal parameters can be changed based on custom profiles based on AVR model.Includes workaround for AVRs with an initial volume set on the Main Zone (eg. VSX-930).Supports AVRs that do not support setting the volume level by emulating using up/down commands (eg. VSX-S510).Command line client for sending commands and testingSupports all listening mode functionsSupports all video related functionsSupports panel and remote lockingSupports most AMP related functionsSupports all tone functionsSupports most zone power functionsSupports all zone input functionsSupports all zone volumne and mute functionsSupports some basic tuner functionsParamsAparamsobject may be passed to the library that modifies its functionality.The default parameters listed below are for AVR models that do not match any custom profile. Custom profiles apply additional default parameters based on the model identifier retrieved from the AVR, and are defined inaiopioneer/param.py. If you need to modify parameters for the library to work for your AVR model, then please create a PR to add a custom profile for your AVR model, or log an issue containing your model number and the parameters that were modified requesting a custom profile to be created.NOTE:YAML syntax is used in the table below. Use Python equivalents (false->False,true->True,null->Noneetc.) when calling the Python API directly, and JSON syntax if manually specifying via the Home Assistant integration.NameTypeDefaultDescriptionignored_zoneslist[]List of zones to ignore even if they are auto-discovered. Specify Zone IDs as strings: "1", "2", "3" and "Z".command_delayfloat0.1Insert a delay between sequential commands that are sent to the AVR. This appears to make the AVR behave more reliably during status polls. Increase this value if debug logging shows that your AVR times out between commands.max_source_idint60Maximum source ID that the source discovery queries. Reduce this if your AVR returns errors.max_volumeint185Maximum volume for the Main Zone.max_volume_zonexint185Maximum volume for zones other than the Main Zone.power_on_volume_bounceboolfalseOn some AVRs (eg. VSX-930) where a power-on is set, the initial volume is not reported by the AVR correctly until a volume change is made. This option enables a workaround that sends a volume up and down command to the AVR on power-on to correct the reported volume without affecting the power-on volume.volume_step_onlyboolfalseOn some AVRs (eg. VSX-S510), setting the volume level is not supported natively by the API. This option emulates setting the volume level using volume up and down commands.ignore_volume_checkboolfalseDon't check volume when determining whether a zone exists on the AVR. Useful for AVRs with an HDZone that passes through audio.zone_1_sourceslist[](>0.4) Customises the available sources for use with Zone 1. Defaults to all available sources.zone_2_sourceslist["04", "06", "15", "26", "38", "53", "41", "44", "45", "17", "13", "05", "01", "02", "33", "46", "47", "99", "10"]Customises the available sources for use with Zone 2 (some AVRs do not support all sources).zone_3_sourceslist["04", "06", "15", "26", "38", "53", "41", "44", "45", "17", "13", "05", "01", "02", "33", "46", "47", "99", "10"]Customises the available sources for use with Zone 3 (some AVRs do not support all sources).hdzone_sourceslist["25", "04", "06", "10", "15", "19", "20", "21", "22", "23", "24", "34", "35", "26", "38", "53", "41", "44", "45", "17", "13", "33", "31", "46", "47", "48"]Customises the available sources for use with HDZone (some AVRs do not support all sources).hdzone_volume_requirementslist["13", "15", "05", "25"]A list of sources that HDZone must be set to for volume control, some AVRs do not support HDZone volume at all (seeignore_volume_checkabove) and some only allow control of certain sources.amplifier_speaker_system_modesdict....Customises the names of speaker system modes. Different generations of AVR will name zones slighty differently. For example, the SC-LX57 names speaker system mode15as5.1ch Bi-Amp + ZONE2however this can also be called5.2ch Bi-Amp + HDZONEon newer AVRs.disabled_amplifier_listening_modeslist[]A list of disabled listening modes / sound modes, all modes are enabled by default, some AVRs have definitions already to disable unsupported modes. If you try to change sound mode to a mode that has not been enabled, the AVR will return an error (usuallyE02).video_resolution_modeslist['0', '1', '3', '4', '5', '6', '7', '8', '9']Sets the available video resolutions. Not all AVRs support the same resolution settings. This defaults to all of the latest resolutions from FY16.mhl_sourcestringnullSets the MHL source ID. This is used for media controls. This information cannot be queried automaticallyenabled_functionslist["amp", "dsp", "tuner", "tone", "channels", "video", "system", "audio"]Change the functions that are enabled by the API, adding more functions will increase the amount of time it takes to complete a full init and update.disable_autoqueryboolfalseSetting totruewill disable auto queries on init for all functions apart from basic functionality (power, source, volume and mute). If you only need those functions, you can set this totrueam_frequency_stepintnullOptional setting to configure the AM frequency step. If this is set tonull, a function is queued to detect this information by stepping up and down the frequency when the tuner is first used while set to AM.debug_listenerboolfalseEnables additional debug logging for the listener task.debug_responderboolfalseEnables additional debug logging for the responder task.debug_updaterboolfalseEnables additional debug logging for the updater task.debug_commandboolfalseEnables additional debug logging for commands sent and responses received.Command line interface (CLI) (>= 0.1.3, CLI arguments >= 0.3)A very simple command line interfaceaiopioneeris available to connect to the AVR, send commands and receive responses. It can be used to test the capabilities of the library against your specific AVR.On Home Assistant, you can run the CLI when thepioneer_asyncHome Assistant integration has been installed. On Home Assistant Supervised or Container, start the CLI from within the HA container:docker exec -it homeassistant aiopioneer.Invoke the CLI with the following arguments:ArgumentDefaultDescriptionhostnamerequiredhostname for AVR connection-p--port8102port for AVR connection+Q--no-query-device-infoNoneskip AVR device info query+Z--no-query-zonesNoneskip AVR zone queryThe CLI accepts all API commands, as well as the following:CommandArgumentDescriptionexitorquitExit the CLI.zonezoneChange current zone tozone.log_levellog_levelChange debug level tolog_level. Valid log levels are:debug,info,warning,error,critical.updateRequest update of AVR. An update is scheduled in the updater task if a scan interval is set, if it is not set then the update is performed synchronously.update_fullRequest a full update of AVR irrespective of when the previous update was performed. An update is scheduled in the updater task if a scan interval is set, if it is not set then the update is performed synchronously.query_device_infoQuery the AVR for device information.query_zonesQuery the AVR for available zones. Ignore zones specified in parameterignored_zones(list).build_source_dictQuery the sources from the AVR.set_source_dictsources(JSON)Manually set the sources tosources.get_source_listReturn the current set of available source names that can be used with theselect_sourcecommand.get_paramsReturn the currently active set of parameters.get_user_paramsReturn the currently active set of user parameters.set_user_paramsparams(JSON)Set the user parameters toparams.get_toneReturns the current AVR tone attributes.get_ampReturns the current AVR amp attributes.get_tunerReturns the current AVR tuner attributes.get_channel_levelsReturns the current AVR channel levels.get_dspReturns the current AVR DSP attributes.get_videoReturns the current AVR video parameters.get_audioReturns the current AVR audio parameters.get_systemReturns the AVR system attributes.debug_listenerstate(bool)Enable/disable thedebug_listenerparameter.debug_responderstate(bool)Enable/disable thedebug_responderparameter.debug_updaterstate(bool)Enable/disable thedebug_updaterparameter.debug_commandstate(bool)Enable/disable thedebug_commandparameter.set_scan_intervalscan_interval(float)Set the scan interval toscan_interval.get_scan_intervalReturn the current scan interval.set_volume_levelvolume_level(int)Set the volume level for the current zone.select_sourcesource_nameSet the input source for the current zone.set_tuner_frequencybandfrequencySet the tuner band and (optionally) frequency.send_raw_commandraw_commandSend the raw commandraw_commandto the AVR.NOTE:The CLI interface may change in the future, and should not be used in scripts. Use the Python API instead.Source listIDDefault Name25BD04DVD06SAT/CBL15DVR/BDR19HDMI 120HDMI 221HDMI 322HDMI 423HDMI 524HDMI 634HDMI 726NETWORK (cyclic)38INTERNET RADIO53Spotify41PANDORA44MEDIA SERVER45FAVORITES17iPod/USB05TV01CD13USB-DAC02TUNER00PHONO12MULTI CH IN33BT AUDIO31HDMI (cyclic)46AirPlay (Information only)47DMR (Information only)Known issues and future plansDocument PioneerAVR APIBreaking changes0.4zone_z_sourceswas renamedhdzone_sourcesfor even more consistency.0.3zone_h_sourceswas renamedzone_z_sourcesfor consistency.0.2volume_step_deltahas been removed entirely.By default, a number of additional queries are sent at module startup to the AVR to gather amp, tuner and channel levels attributes. If your AVR does not handle these additional queries well, they can be disabled by setting parameterdisable_autoquerytotrue.0.1_PioneerAVR.__init__()no longer acceptscommand_delay,volume_workaroundandvolume_stepsarguments. Configure these parameters using the equivalentPARAM_*keys in theparamsdict, passed in via the constructure or set viaset_user_params().ReferencesHome Assistant Pioneer integration:https://www.home-assistant.io/integrations/pioneer/Pioneer commands references:https://github.com/rwifall/pioneer-receiver-notesAnother asyncio Pioneer HA component:https://github.com/realthk/asyncpioneerPioneer IP and serial IO control documentation:https://www.pioneerelectronics.com/PUSA/Support/Home-Entertainment-Custom-Install/RS-232+&+IP+Codes/A+V+Receivers