npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yamaha-nodejs

v0.9.6

Published

An API to control your YAMAHA Receiver written in nodejs

Downloads

457

Readme

Yamaha-nodejs

NPM Downloads Dependency Status

A node module to control your yamaha receiver. Tested with RX-V775, should work with all yamaha receivers with a network interface.

Install

npm install yamaha-nodejs

Example

var YamahaAPI = require("yamaha-nodejs");
var yamaha = new YamahaAPI("192.168.0.100");
yamaha.powerOn().then(function(){
	console.log("powerOn");
	yamaha.setMainInputTo("NET RADIO").then( function(){
		console.log("Switched to Net Radio");
		yamaha.selectWebRadioListItem(1).then(function(){
			console.log("Selected Favorites");
			yamaha.selectWebRadioListItem(1).then(function(){});
		});

	});
});

Prerequisites

  • To power on the yamaha, network standby has to be enabled
  • The Yamaha reveiver is stateful. Some commands only work work if the receiver is in the right state. E.g. to get web radio channels, the "NET RADIO" input has to be selected.

Methods

var yamaha = new Yamaha("192.168.0.100")
var yamaha = new Yamaha() // Auto-Discovery
yamaha.powerOff(zone) // or "System" for sytem power
yamaha.powerOn(zone)  // or "System" for sytem power
yamaha.isOn(zone)
yamaha.isOff(zone)

//Volume
yamaha.setVolumeTo(-500, zone) // Value must be divisble by 5 or value will be rejected
yamaha.volumeUp(50, zone)
yamaha.volumeDown(50, zone)
yamaha.muteOn(zone)
yamaha.muteOff(zone)

//Extended Volume Settings
yamaha.setBassTo(60)          //-60 to 60 (may depend on model)
yamaha.setTrebleTo(60)        //-60 to 60 (may depend on model)
yamaha.setSubwooferTrimTo(60) //-60 to 60 (may depend on model)
yamaha.setDialogLiftTo(5)     //0 to 5 (may depend on model)
yamaha.setDialogLevelTo(3)    //0 to 3 (may depend on model)
yamaha.YPAOVolumeOn()
yamaha.YPAOVolumeOff()
yamaha.extraBassOn()
yamaha.extraBassOff()
yamaha.adaptiveDRCOn()
yamaha.adaptiveDRCOff()

//Playback
yamaha.stop(zone)
yamaha.pause(zone)
yamaha.play(zone)
yamaha.skip(zone)
yamaha.rewind(zone)

//Remote (Case Sensitive Values)
yamaha.remoteCursor(command) // 'Up', 'Down', 'Left', 'Right', 'Return', 'Sel'
yamaha.remoteMenu(command)   // 'Option', 'Display'

//Switch Input
yamaha.setInputTo("USB", 2)
yamaha.setMainInputTo("NET RADIO")

//Party Mode
yamaha.partyModeOn()
yamaha.partyModeOff()
yamaha.partyModeUp()
yamaha.partyModeDown()

//Basic
yamaha.SendXMLToReceiver()

//Get Info
yamaha.getBasicInfo(zone).done(function(basicInfo){
    basicInfo.getVolume();
    basicInfo.isMuted();
    basicInfo.isOn();
    basicInfo.isOff();
    basicInfo.getCurrentInput();
    basicInfo.isPartyModeEnabled();
    basicInfo.isPureDirectEnabled();
    basicInfo.getBass();
    basicInfo.getTreble();
    basicInfo.getSubwooferTrim();
    basicInfo.getDialogueLift();
    basicInfo.getDialogueLevel();
		basicInfo.getZone();
    basicInfo.isYPAOVolumeEnabled();
    basicInfo.isExtraBassEnabled();
    basicInfo.isAdaptiveDRCEnabled();
})

yamaha.isHeadphoneConnected()
yamaha.getSystemConfig()
yamaha.getAvailableInputs()
yamaha.isMenuReady("NET_RADIO")

// FM Tuner
yamaha.getTunerInfo()
yamaha.getTunerPresetList()
yamaha.selectTunerPreset(1)
yamaha.selectTunerFrequency(band, frequency)

//Select Menu Items
yamaha.selectUSBListItem(1)
yamaha.selectWebRadioListItem(1)

// Single Commands, receiver has to be in the right state
yamaha.getWebRadioList()
yamaha.selectWebRadioListItem(1)

// Chained Commands, they ensure the receiver is in the right state
yamaha.switchToFavoriteNumber()
yamaha.gotoFolder('/NET_RADIO/Radio/Favorites', 'NET_RADIO')

// Find the index of a list item to select using the name of the item,
// returns -1 if not found. Will move the list page down so index will always
// between 1 and 8.
yamaha.getIndexOfMenuItem(
    await yamaha.getWebRadioList(), 
    'BBC Radio 1', 
    'NET_RADIO'
)

// Zone Commands
yamaha.getAvailableZones()
yamaha.getZoneConfig(zone)

Zones

The zone parameter is optional, you can pass a number or a string

Promises

All these methods return a promise:

yamaha.isOn().then(function(result){
	console.log("Receiver is:"+result);
})

Execute Tests

mocha mochatest.js --ip 192.168.0.25
or with autodiscovery
mocha mochatest.js

Discovery

If the IP is omitted in the constructor, the module will try to discover the yamaha ip via a SSDP call. Thanks @soef @mwittig

Changelog

0.8:

  • FIX Remove get request delays