Skip to content

node module to interface with onkyo (and pioneer) receivers (eiscp protocol)

License

Notifications You must be signed in to change notification settings

Attila-FIN/node-eiscp

 
 

Repository files navigation

node-eiscp

This is a node module to control and interact with Onkyo receivers over the network.

Basically it is a merge of my previous module which was really simple and https://github.com/miracle2k/onkyo-eiscp translated to javascript, which means a lot more features but some stuff still missing like handling multiple receivers and special commands (ranges are supported though).

How to use it?

Until first release you can add the git url to your package.json like this

{
  "dependencies": {
    "eiscp": "git://github.com/tillbaks/node-eiscp.git"
  }
}

See the examples

https://github.com/tillbaks/node-eiscp/tree/master/examples

Command syntax

Same syntax as https://github.com/miracle2k/onkyo-eiscp thanks dude!

See example 3.js to retreive an array of all available commands

A command consists of three parts: The zone, the command, and the arguments. Here are some examples::

system-power=on
zone2.power=on
main.balance=3

As you can see, the basic format is::

zone.command=argument

If you do not specify a zone, then main is assumed.

There are some variations on this syntax that are possible, for example the following are all equivalent::

power on
power:on
main.power on
main power on

In other words, instead of the . and = separators, whitespace may be used, and the colon : is an alternative to =. However, it's best to use the suggested syntax above.

Events

You will to listen to events to use this module.

.on(command, callback)

Data from connected receiver.

command: (string) - Any supported command like "volume" or "system-power"

callback: (function) - One argument containing the result of the command. If command is volume you would get the volume as a number.

.on("data")

Data from connected receiver.

data:

  • command (string|array) - (array if command has aliases) contains the high-level command
  • argument (string) - string contains the high-level argument
  • iscp_command (string) - string contains the low-level command

.on("connect")

Will fire when connected.

.on("close")

Will fire when disconnected.

.on("error")

Will fire when error is encountered.

message: (string) - contains an error message

.on("debug")

Will fire when debug message is encountered. Use this when developing, you will get useful messages for debugging.

message: (string) - contains a debug message

API

connect ([ options ])

If you only have one receiver on your network there is no need to provide any options, it will be discovered automatically.

options:

  • host (default: undefined) - Hostname or IP of receiver
  • port (default: 60128) - Port of receiver
  • reconnect (default: true) - Reconnect to receiver if connection is lost
  • reconnect_sleep (default: 5) - Time in seconds between reconnection attempts
  • verify_commands (default: true) - Whether to verify high-level commands for model compatibility

discover (options, callback)

Sends a broadcast packet and waits for response

options:

  • address (default: "255.255.255.255") - Hostname or IP of receiver
  • port (default: 60128) - Listening port (NOTE: try changing this if you have trouble connecting)
  • timeout (default: 2) - Time in seconds to wait for respoonses after broadcast is sent

callback: (function) - You will receive one argument cointaining an array of devices

  • devices (array) - An array of objects
    • host - Receiver IP
    • port - Receiver Port
    • model - Receiver Model
    • areacode - Area Code?
    • message - Raw message that was received

raw (data [, callback])

Sends a low-level command like PWR01 or MVL1A

data: (string) - Command to send

callback:

NOTE: Callback does not tell you if the command was successfull only that it was sent to the receiver.

  • result (object)
    • result - true or false if command was sent to receiver
    • msg - If there is a message attached to the result

command (command [, callback])

Sends a high-level command like system-power=query or zone2.volume=1A more info about command syntax can be found above the API

command: (string) - Command to send

callback:

NOTE: Callback does not tell you if the command was successfull only that it was sent to the receiver.

  • result (object)
    • result - true or false if command was sent to receiver
    • msg - If there is a message attached to the result

get_commands (zone, callback)

Retreives an array of all commands in the provided zone

zone: (string) - zone can be "main", "zone2" etc..

callback:

  • commands (array) - Array of all commands

get_command (command, callback)

Retreives an array of all arguments in the provided command

command: (string) - command can be "system-power", "zone2.volume" etc.. (NOTE: If you don't specify zone "main" will be assumed)

callback:

  • arguments (array) - Array of all arguments

Info about yaml/json commands stuff

All commands are in a json file "eiscp-commands.json" and are converted from a YAML file from https://github.com/miracle2k/onkyo-eiscp thanks dude!

Download YAML file:
wget https://raw.github.com/miracle2k/onkyo-eiscp/master/eiscp-commands.yaml
Convert YAML file to json:

Run in node-eiscp directory. This will create "eiscp-commands.json". Warning this script might be badly coded. [:

node eiscp-commands-convert.js

Changes

  • (owagner) added new option "verify_commands", defaulting to true, which yields the previous behavior: High-level commands are verified for model compatibility, and rejected otherwise. Although in theory a good idea, this makes high-level commands unusable for new models which are not yet presented in the yaml file or for which no Onkyo documentation is available yet (as the time of this writing, for example, the latest V 1.26 .xls does not cover the NR535)
  • (owagner) change "reconnect" property to default to true, to match documentation

About

node module to interface with onkyo (and pioneer) receivers (eiscp protocol)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%