Marantz HEOS CLI, AVRX2700H Protocol Specifications

HEOS CLI Protocol Specification
1. Overview
1.1 Supported music services
2. Connection
2.1 Controller Design Guidelines
2.1.1 Driver Initialization
2.1.2 Caveats
2.1.2.2 Issues & Solutions
2.1.3 Miscellaneous
3. Command and Response Overview
3.1 Commands
3.2 Responses
4. Command and Response Details
4.1 System Commands
4.1.1 Register for Change Events
4.1.2 HEOS Account Check
4.1.3 HEOS Account Sign In
4.1.4 HEOS Account Sign Out
4.1.5 HEOS System Heart Beat
4.1.6 HEOS Speaker Reboot
4.1.7 Prettify JSON response
4.2 Player Commands
4.2.1 Get Players
4.2.2 Get Player Info
4.2.3 Get Play State
4.2.4 Set Play State
4.2.5 Get Now Playing Media
4.2.6 Get Volume
4.2.7 Set Volume
4.2.8 Volume Up
4.2.9 Volume Down
4.2.10 Get Mute
4.2.11 Set Mute
4.2.12 Toggle Mute
4.2.13 Get Play Mode
4.2.14 Set Play Mode
4.2.15 Get Queue
4.2.16 Play Queue Item
4.2.17 Remove Item(s) from Queue
4.2.18 Save Queue as Playlist
4.2.19 Clear Queue
4.2.20 Move Queue
4.2.21 Play Next
4.2.22 Play Previous
4.2.23 Set QuickSelect [LS AVR Only]
4.2.24 Play QuickSelect [LS AVR Only]
4.2.25 Get QuickSelects [LS AVR Only]
4.2.26 Check for Firmware Update
4.3 Group Commands
4.3.1 Get Groups
4.3.2 Get Group Info
4.3.3 Set Group
4.3.4 Get Group Volume
4.3.5 Set Group Volume
4.2.6 Group Volume Up
4.2.7 Group Volume Down
4.3.8 Get Group Mute
4.3.9 Set Group Mute
4.3.10 Toggle Group Mute
4.4 Browse Commands
4.4.1 Get Music Sources
4.4.2 Get Source Info
4.4.3 Browse Source
4.4.4 Browse Source Containers
4.4.5 Get Source Search Criteria
4.4.6 Search
4.4.7 Play Station
4.4.8 Play Preset Station
4.4.9 Play Input source Limitations for the system when used multi devices.
4.4.10 Play URL
4.4.11 Add Container to Queue with Options
4.4.12 Add Track to Queue with Options
4.4.13 Get HEOS Playlists
4.4.14 Rename HEOS Playlist
4.4.15 Delete HEOS Playlist
4.4.16 Get HEOS History
4.4.17 Retrieve Album Metadata
4.4.18 Get Service Options for now playing screen - OBSOLETE
4.4.19 Set service option
5. Change Events (Unsolicited Responses)
5.1 Sources Changed
5.2 Players Changed
5.3 Group Changed
5.4 Player State Changed
5.5 Player Now Playing Changed
5.6 Player Now Playing Progress
5.7 Player Playback Error
5.8 Player Queue Changed
5.9 Player Volume Changed
5.10 Player Repeat Mode Changed
5.11 Player Shuffle Mode Changed
5.12 Group Volume Changed
5.13 User Changed
6.0 Error Codes
6.1 General Error Response
6.2 Error Code description
Version HEOS Version Modifications Date Author
1.0 1.280.96 Initial release. 12/20/2014 Prakash Mortha
1.1 1.304.61 Add set service option command.
05/27/2015 Prakash Mortha
1.2 1.310.170 Remove support for play url. Special characters ('&,'=', and '%') are encoded.
08/06/2015 Prakash Mortha
1.3 1.331.70 Add reboot command. Support Tidal/SoundCloud /Amazon Music. Extend get_search_criteria to indicate if Play-All option is supported on searched tracks. Ability to create new station through Artist/Show /Track name. Add service specific transport control option list.
12/03/2015 Prakash Mortha
1.4 1.331.120 Bug fixes. Documentation changes: Add transport control options for Amazon Music. Known Issues: Range queries doesn't work on Amazon Music.
01/21/2016 Prakash Mortha
1.5 1.349.101 Add preset command to play stations from HEOS Favorites. Add players network connection type in get_players and get_player_info command responses. Fix issue with range queries on Amazon Music. Add issues and solutions section. Refer Issues & Solutions. Remove support for Rdio as it is gone.
04/13/2016 Prakash Mortha
1.6 1.364.110 Add limitations while using inputs. Add AVR inputs list.
07/25/2016 Prakash Mortha
1.7 1.373.100 Add Source id for each Music service and source. Remove unused change events: source_data_changed, group_changed, player_mute_changed, group_mute_changed.
09/21/2016 Prakash Mortha
1.8 1.397.190 Add support for Juke music service. Add support for adding station to HEOS Favorites from browse menu. Expand Thumbs Up/Down option to more music services. [LS AVR only] Add new commands set_quickselect, play_quickselect, and get_quickselects.
04/12/2017 Prakash Mortha
1.9 1.406.140 Add support to Play Url 05/23/2017 Prakash Mortha
1.10 1.430.160 Add check_update command. Add new response field 'serial' to get_players and get_player_info command responses. Add new response fields 'available' and 'service_username' to get_music_sources and get_source_info command reponses. Add QQMusic to the supported music service list.
11/20/2017 Prakash Mortha
1.11 1.442.150 Add new field value (unknown) to network connection types. Clarify on 'available' field in 'Get Music Sources' and 'Get Source Info' command response.
02/15/2018 Prakash Mortha
1.12 1.442.150 Document more inputs 05/14/2018 Prakash Mortha
1.13 1.481.130 Remove support for Juke Music service. Juke support is currently removed from HEOS. Add option '21 - Playable Container' to support playable containers on Windows Media share. Add popular list of system errors.
10/31/2018 Prakash Mortha
1.14 1.505.140 Remove "inputs/analog" from input source name for Play input source command. Add "inputs /analog_in_1", "inputs /analog_in_2" and "inputs /recorder_in_1" to input source name for Play input source command.
04/24/2019 Yasuchika Ishida
1. Overview
The Denon HEOS is a network connected, wireless, multi-room music system. The HEOS Command Line Interface (CLI) allows external control systems to manage, browse, play, and get status from the Denon HEOS products. The HEOS CLI is accessed through a telnet connection between the HEOS product and the control system. The control system sends commands and receives responses over the network connection. The CLI commands and responses are in human readable (ascii) format. The command is a text string and the responses are in JSON format. The commands and responses for browsing music servers and services use a RESTFUL like approach while other commands and responses are more static.
1.1 Supported music services
Following table list out all supported online music services through HEOS. Please note, currently not all services are supported through CLI.
Source ID (sid) Service Name Browse through CLI Search/New station through CLI
1 Pandora Yes Yes (Create New Station)
2 Rhapsody Yes Yes
3 TuneIn Yes Yes
4 Spotify No No
5 Deezer Yes Yes
6 Napster Yes Yes
7 iHeartRadio Yes Yes (Create New Station)
8 Sirius XM Yes No
9 Soundcloud Yes Yes
10 Tidal Yes Yes
11 Future service N/A N/A
12 Rdio Not supported in HEOS Not supported in HEOS
13 Amazon Music Yes No
14 Future service N/A N/A
15 Moodmix No No
16 Juke Not supported in HEOS Not supported in HEOS
17 Future service N/A N//A
18 QQMusic No No
1.
2.
3.
4.
Following table list out other supported music sources through CLI.
Source ID (sid) Source name Browse supported Search supported
1024 Local USB Media/ Local DLNA servers Yes Yes
1025 HEOS Playlists Yes No
1026 HEOS History Yes No
1027 HEOS aux inputs Yes No
1028 HEOS Favorites Yes No
2. Connection
The HEOS products can be discovered using the UPnP SSDP protocol. Through discovery, the IP address of the HEOS products can be retrieved. Once the IP address is retrieved, a telnet connection to port 1255 can be opened to access the HEOS CLI and control the HEOS system. The HEOS product IP address can also be set statically and manually programmed into the control system. Search target name (ST) in M-SEARCH discovery request is 'urn:schemas-denon-com:device:ACT-Denon:1'.
The control system should use various Get commands to determine the players and groups currently in the HEOS system.
Controller software can control all HEOS speakers in the network by establishing socket connection with just one HEOS speaker. It is recommended not to establish socket connection to each HEOS speaker. This is to decrease network traffic caused by establishing socket connection to each HEOS speaker. Controller software can open multiple socket connections to the single HEOS speaker. Typically controllers will use one connection to listen for change events and one to handle user actions.
2.1 Controller Design Guidelines
2.1.1 Driver Initialization
In order to reduce number of UPnP devices running on the network, HEOS Speaker runs CLI module in a dormant mode. HEOS speaker spawns CLI core modules when the controller establishes the first socket connection to the speaker. What it all means for controller?
Inability of CLI module to process player commands. This is because, by nature of UPnP, CLI module need some time to discover all players before they can be identified by their unique Id (pid) Spew of events when controller initially connects to the speaker. In order to avoid excessive event handling in a event driven controller system, the following initialization sequence is suggested:
Un-register for change events. By default speaker doesn't send unsolicited events but still it is a good idea to send un­register command.This is done through 'register_for_change_events' command. If user credentials are available, sign-in to HEOS user account. This is done through 'sign_in' command. Retrieve current HEOS ecosystem status. This is done through commands like 'get_players', 'get_sources', 'get_groups', 'get_queue', 'get_now_playing_media', 'get_volume', 'get_play_state' etc.
Register for change events. This is done through 'register_for_change_events' command. If controller design involves disconnect and reconnect to HEOS speakers through CLI, it is recommended to keep a idle connection to HEOS Speaker thus avoiding CLI module to set back to dormant mode.
2.1.2 Caveats
2.1.2.1 Compatibility
Please take a look at the following suggestions to avoid breaking controller code due to future enhancements
The 'message' field part of HEOS response is a string. The attribute value pair in this message string is delimited by '&'. Further the attribute name and value is separated by '=' sign. Please note that new arguments can be added in the future. New JSON objects may be added to the 'payload' as part of future enhancements.
2.1.2.2 Issues & Solutions
Changes made to HEOS user account, through HEOS app will not reflect through CLI until the controller is restarted. Ex: Adding or removing music services to HEOS user account, through HEOS app will not reflect in get_music_sources command response until the controller is restarted.
Solution: Controller needs to re sign-in to HEOS account to reflect changes made through HEOS app, with out restarting the controller. So, in addition to performing HEOS account sign-in as part of driver initialization process, it is highly recommended to provide sign-out and sign-in option through end users UI screen. End user need to re-signIn when he adds/removes music service through HEOS app.
2.1.3 Miscellaneous
Controllers can add custom argument SEQUENCE=<number> in browse commands to associate command and response. This is possible because the 'message' field in the response packet includes all the arguments sent in the command. Please let us know if you need additional custom argument other than 'SEQUENCE'. This is to avoid accidentally using HEOS command arguments for special purpose. Maximum number of simultaneous socket connections supported by HEOS speaker is 32. Service specific transport control options are as follows:
Services Type Supported Transport Controls
by CLI
Supported Transport Controls in HEOS App (No significance. Only for Reference)
Amazon Music station Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
Deezer station Play, Pause, Stop, PlayNext Play, Pause, PlayNext
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
iHeart Radio station Play, Stop Play, Stop, Scan
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
Napster station Play, Pause, Stop, PlayNext Play, Pause, PlayNext
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
Pandora station Play, Pause, Stop, PlayNext Play, Pause, PlayNext
song NA NA
Rhapsody station Play, Pause, Stop, PlayNext Play, Pause, PlayNext
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
SoundCloud station NA NA
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
SiriusXM station Play, Stop Play, Stop
song NA NA
Tidal station NA NA
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
Tunein station Play, Stop Play, Stop
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
Local Music station NA NA
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
Favorites station *Depending on playing service *Depending on playing service
song NA NA
Playlists station NA NA
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
History station *Depending on playing service *Depending on playing service
song Play, Pause, Stop, PlayNext,
PlayPrevious
Play, Pause, PlayNext, PlayPrevious
AUX Input station Play, Stop Play, Stop
song NA NA
3. Command and Response Overview
3.1 Commands
HEOS CLI commands are in the following general format: heos://command_group/command?attribute1=value1&attribute2=value2&…&attributeN=valueN
Command string delimiter is "\r\n".
Note: Special characters, i.e '&', '=', and '%' in attribute/value needs to be encoded to '%26(&)', '%3D(=)', and '%25(%)'. Most of the time, controllers use the same string that is received in previous command response. For example, while preparing 'play_stream' /'add_to_queue' command, controllers will use the strings obtained in 'browse' command response. Those strings are already encoded. So, controllers are not required to perform any special action. However, controllers might need to decode the encoded strings before they can be properly displayed on the controller GUI.
3.2 Responses
The responses to commands are in JSON format and use the following general structure: { "heos": { "command": "'command_group'/'command'", "result": "'success' or 'fail'", "message": "other result information'" },
"payload":{ 'Rest of response data' } } Some command responses will not include a payload. If the "result" of the command is "fail" then the "message" information contains the error codes for the failure. The error codes can be found in section 'Error Code description'.
Some commands will also cause unsolicited events. For example, sending the 'player/clear_queue' command will cause the Player Queue Changed event and could also cause the Player State Changed event.
When the actual response can't be populated immediately, a special response will be sent back as shown below. This usually occurs during browse/search as CLI needs to retrieve data from remote media server or online service.
{ "heos": { "command": "'command_group'/'command'", "result": "'success'", "message": "command under process'" }
}
JSON command response delimiter is "\r\n".
Note: Special characters '&', '=', and '%' in the JSON response fields are encoded to '%26(&)', '%3D(=)', and '%25(%)'.
4. Command and Response Details
4.1 System Commands
4.1.1 Register for Change Events
By default HEOS speaker does not send Change events. Controller needs to send this command with enable=on when it is ready to receive unsolicit responses from CLI. Please refer to "Driver Initialization" section regarding when to register for change events.
Command: heos://system/register_for_change_events?enable='on_or_off'
Attribute Description Enumeration
enable Register or unregister for change events. on,off
Response: { "heos": { "command": "system/register_for_change_events", "result": "success", "message": "enable='on_or_off'" } }
Example: heos://system/register_for_change_events?enable=on
4.1.2 HEOS Account Check
Command: heos://system/check_account
This command returns current user name in its message field if the user is currently singed in. Response: { "heos": { "command": "system/check_account", "result": "success", "message": "signed_out" or "signed_in&un=<current user name>" } }
Example: heos://system/check_account
4.1.3 HEOS Account Sign In
Command: heos://system/sign_in?un=heos_username&pw=heos_password
Attribute Description Enumeration
un HEOS account username N/A
pw HEOS account password N/A
Response: { "heos": { "command": "system/sign_in ", "result": "success", "message": "signed_in&un=<current user name>" } }
Example: heos://system/sign_in?un=user@gmail.com&pw=12345
4.1.4 HEOS Account Sign Out
Command: heos://system/sign_out Response: { "heos": { "command": "system/sign_out ", "result": "success", "message": "signed_out" } }
Example: heos://system/sign_out
4.1.5 HEOS System Heart Beat
Command: heos://system/heart_beat Response: { "heos": { "command": "system/heart_beat ", "result": "success" "message": "" } }
Example: heos://system/heart_beat
4.1.6 HEOS Speaker Reboot
Using this command controllers can reboot HEOS device. This command can only be used to reboot the HEOS device to which the controller is connected through CLI port.
Command: heos://system/reboot Response: { "heos": { "command": "system/reboot", "result": "success" "message": "" } }
Example: heos://system/reboot
4.1.7 Prettify JSON response
Helper command to prettify JSON response when user is running CLI controller through telnet.
Command: heos://system/prettify_json_response?enable='on_or_off'
Attribute Description Enumeration
enable Enable or disable prettification of JSON response. on,off
Response: { "heos": { "command": "system/prettify_json_response", "result": "success", "message": "enable='on_or_off'" } }
Example: heos://system/prettify_json_response?enable=on
4.2 Player Commands
4.2.1 Get Players
Command: heos://player/get_players
Attribute Description Enumeration
pid Player id N/A
gid pid of the Group leader N/A
network Network connection type
wired wifi unknown (not applicable for external controllers)
lineout LineOut level type 1 - variable
2 - Fixed
control Only valid when lintout level type is Fixed
(2).
1 - None 2 - IR 3 - Trigger 4 - Network
serial Only listed if device has valid serial
number
N/A
Note: The group id field (gid) is optional. The 'gid' field will only be appeared if the player(s) is part of a group. Note: control field is only populated when lineout level type is Fixed (lineout = 2)
Response: { "heos": { "command": "player/get_players", "result": "success", "message": "" }, "payload": [ { "name": "'player name 1'", "pid": "player id 1'", "gid": "group id'", "model": "'player model 1'", "version": "'player verison 1'" "network": "wired" "lineout": "level type" "control": "control option" "serial": "serial number" }, { "name": "'player name 2'", "pid": "player id 2'", "gid": "group id'", "model": "'player model 2'", "version": "'player verison 2'" "network": "wifi" "lineout": "level type" "control": "control option" "serial": "serial number" }, .
. . { "name": "'player name N'", "pid": "player id N'", "gid": "group id'", "model": "'player model N'", "version": "'player verison N'" "network": "wifi" "lineout": "level type" "control": "control option" "serial": "serial number" } ] }
Example: heos://player/get_players
4.2.2 Get Player Info
Command: heos://player/get_player_info?pid=player_id
Attribute Description Enumeration
pid Player id returned by 'get_players' or
'get_groups' command
N/A
gid pid of the Group leader N/A
network Network connection type
wired wifi unknown (not applicable for external controllers)
lineout LineOut level type 1 - variable
2 - Fixed
control Only valid when lintout level type is Fixed
(2).
1 - None 2 - IR 3 - Trigger 4 - Network
serial Only listed if device has valid serial
number
N/A
Note: The group id field (gid) is optional. The 'gid' field will only be appeared if the player(s) is part of a group. Note: control field is only populated when lineout level type is Fixed (lineout = 2)
Response: { "heos": { "command": "player/get_player_info", "result": "success", "message": "pid='player_id'" }, "payload": { "name": "'player name'", "pid": "player id'", "gid": "group id'", "model": "'player model'", "version": "'player verison'" "network": "wired" "lineout": "level type" "control": "control option" "serial": "serial number" } }
Example: heos://player/get_player_info?pid=1
4.2.3 Get Play State
Command: heos://player/get_play_state?pid=player_id
Attribute Description Enumeration
pid Player id returned by 'get_players' or 'get_groups' command N/A
Response: { "heos": { "command": " player/get_play_state ", "result": "success", "message": "pid='player_id'&state='play_state'" } }
Example: heos://player/get_play_state?pid=1
4.2.4 Set Play State
Command: heos://player/set_play_state?pid=player_id&state=play_state
Attribute Description Enumeration
pid Player id returned by 'get_players' or 'get_groups' command N/A
state Player play state play, pause, stop
Response: { "heos": { "command": " player/set_play_state ", "result": "success", "message": "pid='player_id'&state='play_state'" } }
Example: heos://player/set_play_state?pid=1&state=play
Note: Play state of a group can be controlled by sending set_play_state command to any of the player in the group.
4.2.5 Get Now Playing Media
Command: heos://player/get_now_playing_media?pid=player_id
Attribute Description Enumeration
pid Player id returned by 'get_players' or
'get_groups' command
N/A
id (options) Options available for now playing media Following options are currently supported
for now playing media
11 - Thumbs Up
12 - Thumbs Down
19 - Add station to HEOS Favorites
Response:
The following response provides example when the speaker is playing a song.
Note: For local music and DLNA servers sid will point to Local Music Source id.
{ "heos": { "command": "player/get_now_playing_media", "result": "success", "message": "pid='player_id'" }, "payload": { "type" : "'song'", "song": "'song name'", "album": "'album name'", "artist": "'artist name'", "image_url": "'image url'", "mid": "'media id'", "qid": "'queue id'", "sid": source_id
"album_id": "Album Id'" } }
The following response provides example when the speaker is playing a station.
{ "heos": { "command": "player/get_now_playing_media", "result": "success", "message": "pid='player_id'" }, "payload": { "type" : "'station'", "song": "'song name'", "station": "'station name'", "album": "'album name'", "artist": "'artist name'", "image_url": "'image url'", "mid": "'media id'", "qid": "'queue id'", "sid": source_id }
"options": [ { "play": [ { "id": 19, "name": "Add to HEOS Favorites" } ] } ] }
Example: heos://player/get_now_playing_media?pid=1
4.2.6 Get Volume
Command: heos://player/get_volume?pid='player_id'
Attribute Description Enumeration
pid Player id returned by 'get_players' or 'get_groups' command N/A
Response: { "heos": { "command": " player/ get_volume ", "result": "success", "message": "pid='player_id'&level='vol_level'" } }
Example: heos://player/get_volume?pid=1
4.2.7 Set Volume
Command: heos://player/set_volume?pid=player_id&level=vol_level
Attribute Description Enumeration
pid Player id returned by 'get_players' or 'get_groups' command N/A
level Player volume level 0 to 100
Response: { "heos": { "command": " player/ set_volume ", "result": "success", "message": "pid='player_id'&level='vol_level'" } }
Example: heos://player/set_volume?pid=2&level=30
4.2.8 Volume Up
Command: heos://player/volume_up?pid=player_id&step=step_level
Attribute Description Enumeration
pid Player id returned by 'get_players' or 'get_groups' command N/A
step Player volume step level 1 to 10(default 5)
Response: { "heos": { "command": " player/ volume_up ", "result": "success", "message": "pid='player_id'&step='step_level'" } }
Example: heos://player/volume_up?pid=2&step=5
4.2.9 Volume Down
Command: heos://player/volume_down?pid=player_id&step=step_level
Attribute Description Enumeration
pid Player id returned by 'get_players' or 'get_groups' command N/A
level Player volume step level 1 to 10(default 5)
Response: { "heos": { "command": " player/ volume_down ", "result": "success", "message": "pid='player_id'&step='step_level'" } }
Example: heos://player/volume_down?pid=2&step=5
4.2.10 Get Mute
Command: heos://player/get_mute?pid=player_id
Attribute Description Enumeration
pid Player id returned by 'get_players' or 'get_groups' command N/A
Response: { "heos": { "command": " player/ get_mute ", "result": "success", "message": "pid='player_id'&state='on_or_off'" } }
Example: heos://player/get_mute?pid=1
4.2.11 Set Mute
Command: heos://player/set_mute?pid=player_id&state=on_or_off
Attribute Description Enumeration
pid Player id returned by 'get_players' or 'get_groups' command N/A
state Player mute state on, off
Response: { "heos": { "command": " player/ set_mute ", "result": "success", "message": "pid='player_id'&state='on_or_off'"
} }
Example: heos://player/set_mute?pid=3&state=off
4.2.12 Toggle Mute
Command: heos://player/toggle_mute?pid=player_id
Attribute Description Enumeration
Loading...
+ 32 hidden pages