Giter Club home page Giter Club logo

yamaha-node's Introduction

Yamaha-node

A implementation of some obscure-ish YAMAHA protocol, found in the "AV Controller" App for Android

How to use

// import the library
const {Host} = require("./yamaha-node.js")

// create a Host object
var MyHost = new Host("<ip>")

// list of all available "features" or functions
MyHost.features

// get a specific feature by its name
MyHost.features.find("<feature name>")

// get the state of a feature
let feature = MyHost.features.find("<feature name>")
// do the request
MyHost.getFeature(feature).then(data => {
	// you can (for all features) just use the default .toString() method to get a human friendly name for the feature
	console.log(data.toString())
})

// set the state of a feature
feature = MyHost.features.find("<feature name>")
// do the request
MyHost.setFeature(feature, "<state>").then(res => { // state can be a string or number depending on what the feature is
	console.log(res) // if res === "0", then success all other values are unknown errors
})

working examples can be found in test.js

Documentation of the Definition format: (definition.json)

{
	"endpoint": "<relative path>", // endpoint for all port requests
	"features": [
		{
			"name": "<name>", // the name of your feature
			"type": "<type>", // type of input see "types" part of documentation
			"values": {},     // see "types"
			"mult": aN,       // see "types"
			"setRequest": {
				"data": "<request body>" // the raw string send to the reciver, ${data} gets replaced with value
			},
			"locationGet": {
				"location": [],          // see "location"
				"sReqId": "<request id>" // Request ID
			}
		}, <etc>
	]

	"requests": {
		"<request id>": {
			"cacheTime": aN,         // time in ms a cache is valid
			"data": "<request body>" // raw string send to the reciver
		}
	}
}

types

Possible types are:

  • toggle

    "type": "toggle",
    "values": {
    	"tName": "<name when true>"
        "fName": "<name when false>"
    },
    "mult": null
  • range

    "type": "range",
    "values": {
    	"max": <maximal value>,
    	"min": <minimal value>,
    	"step": <least significant unit,
    	"avg": <default value>
     }
    "mult": <multiplier>
  • input

    "type": "input",
    "values": [
    	{
    		"tName": "<technical name>",
    		"fName": "<friendly name>",
    		"desc":  "Description of input"
    	}
    ],
    "mult": null

location

A array of elements usually separated by 0s

for example the power location looks like:

["YAMAHA_AV", "Main_Zone", 0, "Basic_Status", 0, "Power_Control", 0 "Power", 0]

yamaha-node's People

Contributors

derzombiiie avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.